Title
Caption for the next dialog. Empty uses the action-specific system caption.
Open file, save, folder, color, font and print-related dialogs.
A cancelled dialog is a normal outcome. Read the result before performing a file operation, and never turn an empty selection into a default path silently. A picker grants the user a choice; it does not mean the later read or write cannot fail.
Add CommonDialog to the component tray and name it dlgCommon for this example:
| Property | Example value |
|---|---|
Title | "McBasic CommonDialog" |
Filter | "Text files|*.txt;*.md" |
FileName | "notes.txt" |
Color | "#1565C0" |
Font | "System|13|Regular|Normal" |
PrinterName | "" |
PaperName | "" |
PageOrientation | "Portrait" |
PageWidth | 612 |
PageHeight | 792 |
Use the full lesson for the owner’s initialization code and its complete layout.
Contract defaults are shown below. Where a new control has a different Designer starting value, that value is listed separately.
TitleCaption for the next dialog. Empty uses the action-specific system caption.
FilterFile filter as Description|*.ext;*.ext. Empty permits all file types.
FileNameSelected absolute file or folder path; for Save it also supplies the suggested name.
ColorSelected color as #RRGGBB or #AARRGGBB. Empty uses the current system accent initially.
FontSelected font as Family|Size|Regular/Bold|Normal/Italic. Empty uses the system font initially.
PrinterNameSelected printer name. Empty uses the current system printer.
PaperNameSelected paper name. Empty uses the current system paper.
PageOrientationPage orientation: Portrait or Landscape.
PageWidthSelected paper width in points.
Range: 1 to 100000.
PageHeightSelected paper height in points.
Range: 1 to 100000.
CancelledRead-only state set when the user cancels the last dialog; platform errors raise a McBasic™ error instead.
LastActionRead-only name of the last completed or cancelled dialog action.
Replace control with the object’s Name when creating a handler. ByRef arguments may be changed by your handler; ByVal arguments report an input value.
No events are declared.
Sub ShowOpen()Call on your instance: dlgCommon.ShowOpen.
Sub ShowSave()Call on your instance: dlgCommon.ShowSave.
Sub ShowFolder()Call on your instance: dlgCommon.ShowFolder.
Sub ShowColor()Call on your instance: dlgCommon.ShowColor.
Sub ShowFont()Call on your instance: dlgCommon.ShowFont.
Sub ShowPrinter()Call on your instance: dlgCommon.ShowPrinter.
Sub ShowPageSetup()Call on your instance: dlgCommon.ShowPageSetup.
20f4bfed6b · Build manifest