GEOS SDK TechDocs
|
|
3.5 Matching a File's Geode Attributes
|
3.7 Matching a File's File Attributes
ATTR_GEN_FILE_SELECTOR_NAME_MASK, MSG_GEN_FILE_SELECTOR_SET_MASK, MSG_GEN_FILE_SELECTOR_GET_MASK
By setting up a filename mask, you can limit the File Selector's displays to only those files that conform to the mask characters. For example, to show only those files with the .BAT extender, you could set the mask to *.BAT.
Only one mask may be in use at any given time. If you need to mask for two different sets of characters (e.g. *.BAT and *.EXE), you will need to subclass the File Selector and modify its behavior. (See Searching Via Callback Routine for more information.)
The mask is stored in the File Selector's variable data instance attribute
ATTR_GEN_FILE_SELECTOR_NAME_MASK
and consists of a null-terminated character string.
This field is defined as type
GenFileSelectorMask
, the same as
FileLongName
. This string may contain the DOS "
*
" and "
?
" wildcard characters. The filter applied by the File Selector is the same as that applied by the
FileEnum()
routine detailed in the File System chapter. In short, the mask is taken as a character string matched to the entire file name (thus, a mask of *.*
implies all files with a period in their names; the period separating a filename and an extension will not count as a period).
Normally, the mask is applied only to files and not to directories or volumes. However, if the
GFSI_fileCriteria
attribute FSFC_USE_MASK_FOR_DIRS is set, directories will also be subject to the mask. (Volumes are never subject to the mask filter.)
By default, the mask filter is case-sensitive. You can make the mask filter be case-insensitive, however, by setting FSFC_MASK_CASE_INSENSITIVE in the File Selector's
GFSI_fileCriteria
instance field.
You can set the mask in your application's Goc code or by sending the message
MSG_GEN_FILE_SELECTOR_SET_MASK
to the File Selector. To retrieve the current mask, use
MSG_GEN_FILE_SELECTOR_GET_MASK
. If you do not explicitly set a mask string, the File Selector will not make any filename mask comparisons.
void MSG_GEN_FILE_SELECTOR_SET_MASK(
char *mask);
This message sets the
ATTR_GEN_FILE_SELECTOR_NAME_MASK
variable instance field of the File Selector. This field contains a null-terminated character string (of type
GenFileSelectorMask
); during a directory scan, the File Selector checks all filenames against this mask, and only those files that contain the mask characters are displayed. The mask string may contain DOS wildcard characters ("
*
" and "
?
").
The mask works for both DOS and GEOS files. However, unless the FSFC_USE_MASK_FOR_DIRS flag is set in the
GFSI_fileCriteria
attribute, directories will be unaffected by the mask. Volumes are unaffected in any case.
If the File Selector is visible on the screen when it receives this message, it will automatically rescan the current directory with the new mask. Otherwise, the new mask will be stored for later use.
Source: Unrestricted.
Destination: Any GenFileSelector object.
Parameters:
mask
A pointer to the mask string to be set. This is a null-terminated character string.
Return: Nothing.
Interception: Generally not intercepted.
See Also:
MSG_GEN_FILE_SELECTOR_SET_FILE_CRITERIA
void MSG_GEN_FILE_SELECTOR_GET_MASK(
char *mask);
This message returns the mask string in the File Selector's
ATTR_GEN_FILE_SELECTOR_NAME_MASK
field.
Source: Unrestricted.
Destination: Any GenFileSelector object.
Parameters:
mask
A pointer to an empty character string. The string must be at least
sizeof(GenFileSelectorMask)
characters.
Return: The character string pointed to by
mask
will contain the mask string set in
ATTR_GEN_FILE_SELECTOR_NAME_MASK
.
Interception: Generally not intercepted.
See Also:
MSG_GEN_FILE_SELECTOR_SET_MASK, MSG_GEN_FILE_SELECTOR_SET_FILE_CRITERIA
GEOS SDK TechDocs
|
|
3.5 Matching a File's Geode Attributes
|
3.7 Matching a File's File Attributes