Dialog Controls

The Dialogs tab provides non-visual components that invoke standard OS dialog boxes. Drop them on a form and call their Execute() method to display the native dialog.

TOpenDialog CT_OPENDIALOG = 40

Standard file open dialog. Allows the user to browse and select one or more files to open.

PropertyTypeDefaultDescription
cFileNameString""Selected file path (after Execute)
cFilterString"All files (*.*)|*.*"File type filter (pipe-delimited pairs)
nFilterIndexNumeric1Default filter index
cTitleString"Open"Dialog title bar text
cInitialDirString""Starting directory
cDefaultExtString""Default file extension
lMultiSelectLogical.F.Allow selecting multiple files
aFileNamesArray{}Selected files (when multi-select)
EventCategoryDescription
OnCloseActionDialog closed (after user selects or cancels)
MethodReturnsDescription
Execute()LogicalShows the dialog. Returns .T. if user selected a file, .F. if cancelled.
PlatformNative Dialog
WindowsGetOpenFileName() / IFileOpenDialog
macOSNSOpenPanel
LinuxGtkFileChooserDialog (GTK_FILE_CHOOSER_ACTION_OPEN)
// Open a file dialog with filters
DEFINE OPENDIALOG oDlg
oDlg:cTitle := "Select Image"
oDlg:cFilter := "Images (*.png;*.jpg)|*.png;*.jpg|All files (*.*)|*.*"
oDlg:cInitialDir := "C:\Pictures"
IF oDlg:Execute()
   MsgInfo( "Selected: " + oDlg:cFileName )
ENDIF

TSaveDialog CT_SAVEDIALOG = 41

Standard file save dialog. Prompts the user to choose a filename and location for saving.

PropertyTypeDefaultDescription
cFileNameString""Selected/entered file path
cFilterString"All files (*.*)|*.*"File type filter
nFilterIndexNumeric1Default filter index
cTitleString"Save As"Dialog title
cInitialDirString""Starting directory
cDefaultExtString""Default extension (appended if not typed)
lOverwritePromptLogical.T.Warn when overwriting existing file
EventCategoryDescription
OnCloseActionDialog closed
MethodReturnsDescription
Execute()LogicalShows the dialog. Returns .T. if user confirmed, .F. if cancelled.
PlatformNative Dialog
WindowsGetSaveFileName() / IFileSaveDialog
macOSNSSavePanel
LinuxGtkFileChooserDialog (GTK_FILE_CHOOSER_ACTION_SAVE)
// Save document with default extension
DEFINE SAVEDIALOG oDlg
oDlg:cTitle := "Save Report"
oDlg:cFilter := "PDF (*.pdf)|*.pdf|HTML (*.html)|*.html"
oDlg:cDefaultExt := "pdf"
IF oDlg:Execute()
   SaveReport( oDlg:cFileName )
ENDIF

TFontDialog CT_FONTDIALOG = 42

Standard font selection dialog. Lets the user choose a font face, style, size, and color.

PropertyTypeDefaultDescription
cFontNameString""Selected font face name
nFontSizeNumeric10Selected font size (points)
lBoldLogical.F.Bold style selected
lItalicLogical.F.Italic style selected
lUnderlineLogical.F.Underline style selected
nColorColorCLR_BLACKSelected font color
EventCategoryDescription
OnCloseActionDialog closed
MethodReturnsDescription
Execute()LogicalShows the font dialog. Returns .T. if user selected a font.
PlatformNative Dialog
WindowsChooseFont() (CHOOSEFONT struct)
macOSNSFontPanel
LinuxGtkFontChooserDialog

TColorDialog CT_COLORDIALOG = 43

Standard color picker dialog. Allows the user to select a color from a palette or define custom colors.

PropertyTypeDefaultDescription
nColorColorCLR_BLACKSelected color value
aCustomColorsArray{}Array of custom color values
EventCategoryDescription
OnCloseActionDialog closed
MethodReturnsDescription
Execute()LogicalShows the color dialog. Returns .T. if user selected a color.
PlatformNative Dialog
WindowsChooseColor() (CHOOSECOLOR struct)
macOSNSColorPanel
LinuxGtkColorChooserDialog
// Pick a background color
DEFINE COLORDIALOG oDlg
IF oDlg:Execute()
   oForm:nClrPane := oDlg:nColor
   oForm:Refresh()
ENDIF

TFindDialog CT_FINDDIALOG = 44

Modeless find dialog. Provides a text search interface with options for match case and direction.

PropertyTypeDefaultDescription
cFindTextString""Text to search for
lMatchCaseLogical.F.Case-sensitive search
lWholeWordLogical.F.Match whole words only
lSearchDownLogical.T.Search direction (down = forward)
EventCategoryDescription
OnFindActionUser clicked Find Next
OnCloseActionDialog closed
MethodReturnsDescription
Execute()LogicalShows the modeless find dialog.
PlatformNative Dialog
WindowsFindText() (FINDREPLACE struct)
macOSNSTextFinder (find bar)
LinuxGtkSearchBar + custom dialog

TReplaceDialog CT_REPLACEDIALOG = 45

Modeless find-and-replace dialog. Extends TFindDialog with replace functionality.

PropertyTypeDefaultDescription
cFindTextString""Text to search for
cReplaceTextString""Replacement text
lMatchCaseLogical.F.Case-sensitive search
lWholeWordLogical.F.Match whole words only
EventCategoryDescription
OnFindActionUser clicked Find Next
OnReplaceActionUser clicked Replace
OnReplaceAllActionUser clicked Replace All
OnCloseActionDialog closed
MethodReturnsDescription
Execute()LogicalShows the modeless replace dialog.
PlatformNative Dialog
WindowsReplaceText() (FINDREPLACE struct)
macOSNSTextFinder (find-and-replace bar)
LinuxGtkSearchBar + custom replace dialog
// Find and Replace in a RichEdit
DEFINE REPLACEDIALOG oDlg
oDlg:OnFind := { || FindInEditor( oRichEdit, oDlg:cFindText ) }
oDlg:OnReplace := { || ReplaceInEditor( oRichEdit, oDlg:cFindText, oDlg:cReplaceText ) }
oDlg:OnReplaceAll := { || ReplaceAllInEditor( oRichEdit, oDlg:cFindText, oDlg:cReplaceText ) }
oDlg:Execute()
6 Dialog Controls

All dialog controls are non-visual components. Drop them on a form, configure their properties, and call Execute() to display the native OS dialog. Each dialog returns .T. when the user confirms and .F. when cancelled.

On This Page

TOpenDialog CT_OPENDIALOG = 40 TSaveDialog CT_SAVEDIALOG = 41 TFontDialog CT_FONTDIALOG = 42 TColorDialog CT_COLORDIALOG = 43 TFindDialog CT_FINDDIALOG = 44 TReplaceDialog CT_REPLACEDIALOG = 45