GetFileName
The GetFileName function opens the Windows Open dialog to browse for a file name string. If the [Open] button is clicked, the selected file name is returned.
|
|
sFileName, bSuccess = GetFileName()
where
sFileName is the returned file name.
bSuccess is an optional success flag. If [Open] is clicked, the function returns the file name, sName, and bSuccess=true. If the dialog is canceled, "", false is returned.
If the user cancels this dialog, this function returns boolean false as the second argument. You do not have to use the second argument in the script, but it can be tested and a decision made before the script proceeds.
The "Flip FITS Images" flag in the dialog options list controls whether FITS images are flipped with row number increasing downward. This global flag is updated after you click [Open]. It can also be configured before this dialog opens by using the CImageView:SetFlipFITS method.
The dialog title can be changed using SetFileOpenDlgTitle.
The window shown above was created using the following code:
The Assert function is used following GetFileName to test how the user closed the dialog. If the dialog was closed by clicking [Open], then bSuccess=true; otherwise, bSuccess=false.