This object is accessible through the NSComDlg.Flags property.
Typically you should use it for example like this:
The object provides a set of Boolean properties each controlling
a single flag (option) for a certain dialog type. By using them you
do not need to combine flag values or import/define constants for
these flags (like the MS Common Dialogs control).
Each of the properties listed below is Boolean and read/write.
Each of them corresponds to a single flag (option) for a given
dialog type. The properties are listed by the dialog type they
affect. Note that most flags specify options about the dialog boxes,
but there are a few that indicate specifics of the user selection
after the dialog closes (marked in Blue) .
| Name |
Description |
| Open/Save
file dialog |
MultiSelect |
Default: False
If set to True the open file dialog allows multiple selection
and returns the list of the selected files - see ComDlg.FileName
and ComDlg.FileNames.
Not supported on Pocket PC and most Windows CE devices. |
CreatePrompt |
For file save dialog displays
a prompt if the user enters a non-existent file name. |
FileMustExist |
Allows the user to select
only existing files. |
HelpButton |
Displays the help button on
the dialog. No effect on Pocket PC. |
HideReadOnly |
Hides the Read Only
check box. No effect on Pocket PC. |
NoChangeDir |
Restores the current
directory to its original value if the user changed the
directory while searching for files. Not supported on Windows
CE/Pocket PC. |
NoDereferenceLinks |
Allow selection of the
shortcut files themselves instead of the files to which they
point to. |
NoReadOnlyReturn |
After ShowOpen indicates that
Read only checkbox has not been checked by the user.
Not supported on Windows CE/Pocket PC. |
NoValidate |
Perform no validation of the
entered file name. If set to True you should use only the
FileName property after the ShowOpen/ShowSave returns. The
returned file name may contain invalid characters, for this
flag allows this. No effect on Windows CE (the names are
always checked) |
OverwritePrompt |
ShowSave will show message
box asking the user if he/she really wants to overwrite the
selected file if the user chooses/enters a name of an existing
file. |
PathMustExist |
If the user types path and a
file name in the dialog and the path does not exist a warning
message is shown. |
ShareAware |
Ignore sharing violation. If
this flag is not set the user is not allowed to select a file
which is locked. Not supported on Windows CE/Pocket PC. |
ReadOnly |
Controls the Read only
check box. After return indicates the stat in which it has
been left by the user. Not supported on Windows CE/Pocket PC. |
ExtensionDifferent |
If the
DefaultExt is not empty this flag indicates after
ShowSave that the user has typed file extension different from
the extension specified by that property. |
| Color
dialog |
FullOpen |
Causes the dialog to open
with the advanced options shown (free color selection). Does
not have effect on Pocket PC 2003 and earlier. |
PreventFullOpen |
Disables the button that
opens the advanced options. No effect on Pocket PC 2003 and
earlier. |
RGBInit |
Use the Color
property to initialize the dialog. If the flag is not set the
dialog is not initialized from the current value of the Color
property. |
| Font
dialog |
ANSIOnly |
Show ANSI fonts only
(obsolete - included for backward compatibility). |
Effects |
Show the controls for effects
selection (strike thru, color etc.) |
FixedPitchOnly |
Show fixed pitch fonts only. |
ForceFontExist |
The font must exist. The user
is not allowed to type a face name of non-existent font. If
not set the closest substitution is selected by the system. |
LimitSize |
If set to True the dialog
will show only the font sizes between the values of the Min
and Max properties. |
NoFaceSel |
No initial face selection is
shown in the dialog (the FontName can still be valid and
non-empty, but it is not initially selected when the dialog
opens). |
NoSimulations |
Forbids font simulations to
be made by the GDI. |
NoSizeSel |
Hide the size selection
controls on the dialog. |
NoStyleSel |
Hide the style selection
controls on the dialog. |
NoVectorFonts |
Show no vector fonts in the
list. |
ScalableOnly |
List only fonts that are
scalable. |
ScreenFonts |
List screen fonts. |
TTOnly |
List true type fonts only. |
WYSIWYG |
List only WYSIWYG fonts
(these are in first place fonts available for the both screen
and the printer). |
PrinterFonts |
List printer fonts. |
If you prefer to use combined flag constants you can assign all
the flags composed this way through the Value property of the
object. The object has also two helper methods that can be used to
bring it in well-known state. They are also intended for this kind
of usage. If you want to use the Boolean properties there is no need
to ever use the Value property or the Methods in the following
table.
| Name |
Syntax |
Description |
Value
|
comdlg_object.Flags.Value
= value
comdlg_object.Flags = value
variable = comdlg_object.Flags.Value |
Long integer, default
property. Thanks to the fact that this is default property
flags combined in long integer value can be assigned
syntactically just like with the Microsoft Common Dialogs
ActiveX. The property puts/gets the flags for the dialog type
specified by the NSComDlg.Action
property. If you want to set the flags for all the dialogs at
once (very unlikely) set the Action to 0. Note that due to the
differences between the platforms and the fact that Microsoft
no longer supports their common dialog ActiveX the flags that
have worked on earlier OS versions may cause different
behavior on new OS versions. To be on the safe side it is
recommended to carefully check MSDN or use the properties
listed above. |
SetDefaults |
comdlg_object.Flags.SetDefaults |
Sets the flags for all the
dialog types to their default values. |
Clear |
comdlg_object.Flags.Clear |
Clears all the flags for all
the dialog types. Use with caution! In many cases the common
dialogs require at least one or two flags in order to do
something useful - make sure you are setting new flags after
calling the Clear method. |