2013-02-03
01:55 PM
- last edited on
2023-08-02
03:26 PM
by
Doreena Deng
2013-02-05 11:30 AM
#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,2013-02-07 06:19 AM