License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

DGGetOpenFile and DGBrowseForFolder ignoring default locn

Anonymous
Not applicable
Hi

I am using DGGetSaveFile to save files to an external location, and it works well. I am trying to use DGGetOpenFile to file the same files, however the defLocation parameter seems to be being ignored (it always defaults to the previous folder used). Does anyone know how to get DGGetOpenFile to successfully use the default location? DGBrowseForFolder exhibits the same problem.

Thanks in advance.
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi paulk,

Unfortunately it's a known bug, DGGetOpenFile function ignores the default location parameter.

Until we fix it, you can use DG::FileDialog::OpenFile instead. It's totally the same. Here's a short example code for you how to use:

#include     "DGFileDialog.hpp" 
  
// ----------------------------------------------------------------------------- 
// Select a BMP file with a file dialog 
// ----------------------------------------------------------------------------- 
  
static bool  Select_a_BMPFile (IO::Location* fileLoc) 
{ 
       bool                reply; 
       IO::Location defaultLocation ("C:\\myDefaultLocation"); 
  
       // Instead of DGTypePopupItem use this: 
       FTM::FileTypeManager confManager ("myConfManager"); 
       FTM::FileType       confType    ("BMP File", "bmp", 0, 0, 0); 
       FTM::TypeID         confTypeID = confManager.AddType (confType); 
  
       // Instead of 
       //  reply = DGGetOpenFile (defaultLocation, 1, &popup, NULL, "Select a BMP file"); 
       // use this: 
       DG::FileDialog dialog (DG::FileDialog::OpenFile); 
       GS::UIndex idx = dialog.AddFilter  (confTypeID); 
       dialog.SelectFilter (idx); 
       dialog.SetTitle   ("Select a BMP file"); 
       dialog.SetFolder  (defaultLocation); 
  
       reply = dialog.Invoke (); 
       *fileLoc = dialog.GetSelectedFile (); 
  
       confManager.RemoveType (confTypeID); 
  
       return reply; 
}            // Select_a_BMPFile
Regards,
Tibi
Anonymous
Not applicable
Thanks so much for that Tibi. I found the issue was external to ArchiCAD - being a Win 7 issue, so had resorted to using native Win32 dialogs, but I will implement your suggestion shortly.

Do you by chance know anything about this issue at archicad-talk.graphisoft.com/viewtopic.php?t=41441? I am trying to access element attributes from the rendering API and have not found a to do so yet.

Thanks

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!