We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2015-08-17 10:26 AM - last edited on 2023-07-13 03:43 PM by Doreena Deng
2015-08-17 12:51 PM
static bool GetOpenFile (IO::Location* dloc, const char* fileExtensions, const GS::UniString& filterText) { FTM::TypeID retID; FTM::FileTypeManager ftman ("MyManager"); FTM::FileType type (NULL, fileExtensions, 0, 0, 0); FTM::TypeID id = FTM::FileTypeManager::SearchForType (type); if (id == FTM::UnknownType) id = ftman.AddType (type); DG::FileDialog dlg (DG::FileDialog::OpenFile); // Open only 1 file UIndex i = dlg.AddFilter (id, DG::FileDialog::DisplayExtensions); // Force it on mac... dlg.SetFilterText (i, filterText); if (dlg.Invoke ()) { *dloc = dlg.GetSelectedFile (); return (true); } else return (false); } // ----------------------------------------------------------------------------- // Using: IO::Location dwgFileLoc; if (!GetOpenFile (&dwgFileLoc, "dwg", "*.dwg")) return; IO::Name dwgName; dwgFileLoc.GetLastLocalName (&dwgName);
enum Type { OpenFile, OpenMultiFile, OpenFolder, OpenMultiFolder, Save };
2015-08-17 01:51 PM