cObject
---AbstractFileDialog
------OpenDialog
OpenDialog provides access to the Windows file-open dialog. It permits users to select an existing file (or multiple files, if MultiSelect_State) is set to True, or enter a file name to create.
cSelectFolderDialog allows selecting of a folder instead of a file.
This sample shows how to retrieve a single user-selected file from an OpenDialog.
Use dfAllEnt.pkg Use File_Dlg.pkg Object oPanel is A Panel Set Size To 50 175 Set Location To 25 12 Set Label To 'Open Dialog Example' Object oOpenDialog1 is an OpenDialog Set Filter_String to 'Source|*.src|Include Files|*.inc|Packages|;*.pkg|All Source|*.src;*.pkg;*.inc' Set Initial_Folder to 'C:\Program Files\DataFlex' Set Filter_Index to 2 End_Object Object oOpenButton1 is a Button Set Location To 10 10 Set Label To 'Open...' Procedure OnClick Boolean bOpen bReadOnly String sFileTitle sFileName String[] sSelectedFiles Get Show_Dialog of oOpenDialog1 to bOpen If bOpen Begin Get TickReadOnly_State of oOpenDialog1 to bReadOnly Get File_Title of oOpenDialog1 to sFileTitle Get Selected_Files of oOpenDialog1 to sSelectedFiles Move sSelectedFiles[0] to sFileName If (bReadOnly) ; Move (sFileName + ' (Read-Only)') to sFileName Send Info_Box ; ("File Title=" + sFileTitle + "\nFile Name=" + sFileName) End Else ; Send Info_Box "You did NOT choose a file" End_Procedure End_Object End_Object Start_UI
Use File_Dlg.pkg Object oOpenDialog1 is an OpenDialog Set Filter_String to filter-string Set Initial_Folder to folder-name Set Dialog_Caption to text End_ObjectSee Also