The FileSelector Object: 3.7 File Selector Instance Data: Matching a File's File Attributes

Up: GEOS SDK TechDocs | Up | Prev: 3.6 Masking File Names | Next: 3.8 Searching Via Callback Routine
ATTR_GEN_FILE_SELECTOR_FILE_ATTR, MSG_GEN_FILE_SELECTOR_GET_FILE_ATTRS, MSG_GEN_FILE_SELECTOR_SET_FILE_ATTRS

All files have a number of attributes stored in a record of type FileAttrs . (For full information on FileAttrs , see the File System chapter.) To filter files based on the FileAttrs record, set your File Selector's variable data instance field ATTR_GEN_FILE_SELECTOR_FILE_ATTR to reflect the attributes that must be on and those that must be off.

ATTR_GEN_FILE_SELECTOR_FILE_ATTR is a structure of type GenFileSelectorFileAttrs , shown below. This structure contains two fields: GFSFA_match represents the attributes an acceptable file has on, and GFSFA_mismatch represents the attributes an acceptable file has off.

typedef struct {
     FileAttrs    GFSFA_match;
    FileAttrs    GFSFA_mismatch;
} GenFileSelectorFileAttrs;

The allowable file attributes are listed below and are discussed fully in the File System chapter. If you don't explicitly set the file attribute limitations, the File Selector will automatically filter out all files with either FA_SYSTEM or FA_HIDDEN.

FA_ARCHIVE
This flag indicates that the file requires a backup.
FA_SYSTEM
This flag indicates that the file used by DOS.
FA_HIDDEN
This flag indicates that the file not seen by normal searches.
FA_RDONLY
This flag indicates that the file is read-only.

Note: For directories not to be filtered out when FSFC_DIRS isn't set, you must mismatch FA_SYSTEM and FA_HIDDEN. That is, to show only those subdirectories which match your filter criteria, ensure FSFC_DIRS is not set, and set mismatch attributes thus:

ATTR_GEN_FILE_SELECTOR_FILE_ATTR = {
				0,
				FA_HIDDEN | FA_SYSTEM
}

You may retrieve the current file attributes by sending the message MSG_GEN_FILE_SELECTOR_GET_FILE_ATTRS to the File Selector object. You may set new file attribute limitations by sending it the message MSG_GEN_FILE_SELECTOR_SET_FILE_ATTRS .

MSG_GEN_FILE_SELECTOR_SET_FILE_ATTRS

void	MSG_GEN_FILE_SELECTOR_SET_FILE_ATTRS(
        FileAttrs setAttrs,
        FileAttrs clearAttrs);

This message sets the ATTR_GEN_FILE_SELECTOR_FILE_ATTR vardata instance field of the File Selector. If the File Selector is visible on the screen when it receives this message, it will rescan the directory immediately with the new attributes.

Source: Unrestricted.

Destination: Any GenFileSelector object

Parameters: setAttrs A FileAttrs record to be set into GFSFA_match . Only files with these flags set will pass the filter.

clearAttrs
A FileAttrs record to be set into GFSFA_mismatch . Only files with these flags cleared will pass the filter.

Return: Nothing.

Interception: Generally not intercepted.

See Also: MSG_GEN_FILE_SELECTOR_SET_FILE_CRITERIA

MSG_GEN_FILE_SELECTOR_GET_FILE_ATTRS

word	MSG_GEN_FILE_SELECTOR_GET_FILE_ATTRS();

This message returns the ATTR_GEN_FILE_SELECTOR_FILE_ATTR of the File Selector. This attribute contains two byte-sized fields which represent the match and mismatch attributes (see above).

Source: Unrestricted.

Destination: Any GenFileSelector object.

Parameters: None.

Return: A word value: The high byte represents the mismatch attributes, and the low byte represents the match attributes. To extract these two fields from the returned value, use the macros GET_MATCH_FILE_ATTRS and GET_MISMATCH_FILE_ATTRS (below).

Interception: Generally not intercepted.

See Also: MSG_GEN_FILE_SELECTOR_SET_FILE_CRITERIA

GET_MATCH_FILE_ATTRS

byte	GET_MATCH_FILE_ATTRS(attr);
        word	attr;

This macro extracts the GFSFA_match portion of the word value returned by MSG_GEN_FILE_SELECTOR_GET_FILE_ATTRS . The extracted value is a record of FileAttrs .

GET_MISMATCH_FILE_ATTRS

byte	GET_MISMATCH_FILE_ATTRS(attr);
        word	attr;

This macro extracts the GFSFA_mismatch portion of the word value returned by MSG_GEN_FILE_SELECTOR_GET_FILE_ATTRS . The extracted value is a record of FileAttrs .


Up: GEOS SDK TechDocs | Up | Prev: 3.6 Masking File Names | Next: 3.8 Searching Via Callback Routine