CmnDlgCommon Operating System dialogs Summary | Common Operating System dialogs | | Display standard color dialog | | Display standard Find and Replace dialog boxes. | | Display standard font dialog | | Display standard icon dialog. | | Display standard Open / Save dialog | | | | |
ColorCmnDlg_Color( | ByRef | pColor, | | | | hGui | = | ) |
|
Display standard color dialog ParameterspColor | Initial color and output in RGB format, | hGui | Optional handle to parents HWND |
ReturnsFalse if user canceled the dialog or if error occurred
Find / ReplaceDisplay standard Find and Replace dialog boxes. ParametershGui | Handle to parents HWND | lbl | Label used for communication with dialog. CmnDlg_Event, CmnDlg_FindWhat and CmnDlg_Flags hold the dialog data | flags | Creation flags, see below. | deff | Default text to be displayed at the start of the dialog box in find edit box | defr | Default text to be displayed at the start of the dialog box in replace edit box |
FlagsString containing list of creation flags. You can use “-” prefix to hide that GUI field. d | down radio button selected in Find dialog | w | whole word selected | c | match case selected |
GlobalsDialog box is not modal, so it communicates with the script using 4 global variables: Event | ”close”, “find”, “replace”, “replace_all” | Flags | string contaning flags about user selection; each letter means user has selected that particular GUI element. | FindWhat | user find text | ReplaceWith | user replace text |
ReturnsHandle of the dialog or 0 if dialog can’t be created. Can also return “Invalid Label” if lbl is not valid.
FontCmnDlg_Font( | ByRef | pFace, | | | | ByRef | pStyle, | | | | ByRef | pColor, | | | | | pEffects | = | true, | | | hGui | = | 0 | ) |
|
Display standard font dialog ParameterspFace | Initial font, output | pStyle | Initial style, output | pColor | Initial text color, output | pEffects | Set to false to disable effects (strikeout, underline, color) | hGui | Parent’s handle, affects position |
ReturnsFalse if user canceled the dialog or if error occurred
IconCmnDlg_Icon( | ByRef | sIcon, | | | ByRef | idx, | | | | hGui | = | ) |
|
Display standard icon dialog. ParameterssIcon | Default icon resource, output | idx | Default index within resource, output | hGui | Optional handle of the parent GUI. |
ReturnsFalse if user canceled the dialog or if error occurred RemarksThis is simple and non-fleixibile dialog. If you need more flexibility, use <IconEx> instead.
Open / SaveDisplay standard Open / Save dialog ParametershGui | Parent’s handle, positive number by default 0 (influences dialog position) | Title | Dialog title | Filter | Specify filter as with FileSelectFile. Seperate multiple filters with “|” | DefultFilter | Index of default filter, by default 1 | Root | Specifies startup directory and initial content of “File Name” edit. Directory must have trailing “\”. | DefaulltExt | Extension to append when none given | Flags | White space separated list of flags, by default “FILEMUSTEXIST HIDEREADONLY” |
FlagsALLOWMULTISELECT | Specifies that the File Name list box allows multiple selections | CREATEPROMPT | If
the user specifies a file that does not exist, this flag causes the
dialog box to prompt the user for permission to create the file | DONTADDTORECENT | Prevents
the system from adding a link to the selected file in the file system
directory that contains the user’s most recently used documents. | EXTENSIONDIFFERENT | Specifies that the user typed a file name extension that differs from the extension specified by defaulltExt | FILEMUSTEXIST | Specifies that the user can type only names of existing files in the File Name entry field | FORCESHOWHIDDEN | Forces
the showing of system and hidden files, thus overriding the user
setting to show or not show hidden files. However, a file that is
marked both system and hidden is not shown. | HIDEREADONLY | Hides the Read Only check box. | NOCHANGEDIR | Restores the current directory to its original value if the user changed the directory while searching for files. | NODEREFERENCELINKS | Directs
the dialog box to return the path and file name of the selected
shortcut (.LNK) file. If this value is not specified, the dialog box
returns the path and file name of the file referenced by the shortcut. | NOVALIDATE | Specifies that the common dialog boxes allow invalid characters in the returned file name | OVERWRITEPROMPT | Causes
the Save As dialog box to generate a message box if the selected file
already exists. The user must confirm whether to overwrite the file. | PATHMUSTEXIST | Specifies that the user can type only valid paths and file names. | READONLY | Causes the Read Only check box to be selected initially when the dialog box is created | SHOWHELP | Causes
the dialog box to display the Help button. The hGui receives the
HELPMSGSTRING registered messages that the dialog box sends when the
user clicks the Help button. | NOREADONLYRETURN | Specifies that the returned file does not have the Read Only check box selected and is not in a write-protected directory. | NOTESTFILECREATE | Specifies
that the file is not created before the dialog box is closed. This
flag should be specified if the application saves the file on a
create-nonmodify network share. |
ReturnsSelected FileName or Emtpy when cancelled. If more then one file is selected they are separated by new line character.
ExamplesExample1 ;basic usage
if CmnDlg_Icon(icon, idx := 4) msgbox Icon: %icon%`nIndex: %idx%
if CmnDlg_Color( color := 0xFF00AA ) msgbox Color: %color%
if CmnDlg_Font( font := "Courier New", style := "s16 bold underline italic", color:=0x80) msgbox Font: %font%`nStyle: %style%`nColor: %color%
res := CmnDlg_Open("", "Select several files", "", "", "c:\Windows\", "", "ALLOWMULTISELECT FILEMUSTEXIST HIDEREADONLY") IfNotEqual, res, , MsgBox, %res% return
Example2 ;create gui and set text color
CmnDlg_Font( font := "Courier New", style := "s16 bold italic", color:=0xFF)
Gui Font, %Style% c%Color%, %Font% Gui, Add, Text, ,Hello world..... :roll: Gui, Show, Autosize return
|