GEOS SDK TechDocs
|
|
|
2 File Selector Basics
|
4 File Selector Use
The File Selector is diverse and flexible, and you can customize it in many different ways. Typically, you will only need to add or modify a few lines of Goc code to achieve the results you need; however, if you have changing needs, you can change the File Selector during execution by sending it various messages.
The File Selector has a number of attributes and variable data fields that determine its functionality. These are listed in File Selector Attributes , along with comments and the defaults that are set.
Code Display 14-9 File Selector Attributes
/* Following are several type definitions used in the instance data. */
typedef FileLongName GenFileSelectorSelection; typedef WordFlags FileSelectorFileCriteria; typedef WordFlags FileSelectorAttrs; typedef FileLongName GenFileSelectorMask;
typedef struct {
FileAttrs GFSFA_match;
FileAttrs GFSFA_mismatch;
} GenFileSelectorFileAttrs;
typedef struct {
GeodeAttrs GFSGA_match;
GeodeAttrs GFSGA_mismatch;
} GenFileSelectorGeodeAttrs;
/* GFSI_selection
* The selection field contains the name of the current selection being
* displayed by the File Selector. */
@instance GenFileSelectorSelection GFSI_selection = {0};
/* GFSI_fileCriteria
* The file criteria field contains flags that determine the search and
* filter criteria used by the File Selector when scanning directories. */
@instance FileSelectorFileCriteria GFSI_fileCriteria =
FSFC_DIRS | FSFC_NON_GEOS_FILES |
FSFC_GEOS_EXECUTABLES |
FSFC_GEOS_NON_EXECTUTABLES;
/* Possible flags for GFSI_fileCriteria:
* FSFC_DIRS FSFC_NON_GEOS_FILES
* FSFC_GEOS_EXECUTABLES FSFC_GEOS_NON_EXECUTABLES
* FSFC_MASK_CASE_INSENSITIVE FSFC_FILE_FILTER
* FSFC_FILTER_IS_C FSFC_TOKEN_NO_ID
* FSFC_USE_MASK_FOR_DIRS */
/* GFSI_attrs
* The attributes field determines what features of the File Selector are
* to be implemented. */
@instance FileSelectorAttrs GFSI_attrs = FSA_ALLOW_CHANGE_DIRS |
FSA_HAS_CLOSE_DIR_BUTTON |
FSA_HAS_OPEN_DIR_BUTTON |
FSA_HAS_DOCUMENT_BUTTON |
FSA_HAS_CHANGE_DIRECTORY_LIST |
FSA_HAS_CHANGE_DRIVE_LIST |
FSA_HAS_FILE_LIST;
/* Possible flags for GFSI_attrs:
* FSA_ALLOW_CHANGE_DIRS FSA_SHOW_FIXED_DISKS_ONLY
* FSA_SHOW_FILES_DISABLED FSA_HAS_CLOSE_DIR_BUTTON
* FSA_HAS_OPEN_DIR_BUTTON FSA_HAS_DOCUMENT_BUTTON
* FSA_HAS_CHANGE_DIRECTORY_LIST FSA_HAS_CHANGE_DRIVE_LIST
* FSA_HAS_FILE_LIST FSA_USE_VIRTUAL_ROOT
/* GFSI_destination and GFSI_notificationMsg
* When a user selects a file, the File Selector sends the message
* specified in GFSI_notificationMsg to the object specified in
* GFSI_destination. */
@instance optr GFSI_destination;
@instance Message GFSI_notificationMsg;
/* Token and creator matches
* These two vardata fields filter files according to their tokens.
* A file that has a token other than that set will not be displayed
* by the File Selector. If you only want to match files with certain
* token characters, you can set FSFC_TOKEN_NO_ID in GFSI_fileCriteria. */
@vardata GeodeToken ATTR_GEN_FILE_SELECTOR_TOKEN_MATCH;
@vardata GeodeToken ATTR_GEN_FILE_SELECTOR_CREATOR_MATCH;
/* File attributes
* This vardata field filters files according to the files' native
* attributes. If a file does not have the attributes specified in
* GFSFA_match, or if it has an attribute specified in GFSFA_mismatch,
* it will not be displayed. */
@vardata GenFileSelectorFileAttrs ATTR_GEN_FILE_SELECTOR_FILE_ATTR;
/* Geode attributes
* This vardata field filters files according to the files' geode
* attributes. If a file does not have the attributes specified in
* GFSGA_match, or if it has an attribute specified in GFSGA_mismatch,
* it will not be displayed. */
@vardata GenFileSelectorGeodeAttrs ATTR_GEN_FILE_SELECTOR_GEODE_ATTR;
/* Mask
* This vardata field filters files based on their names. The mask is
* a text string matched against file names. Files which coincide with the
* mask string are displayed; others are not. The mask string will also
* be applied to volumes and directories if FSFC_USE_MASK_FOR_DIRS is
* set in GFSI_fileCriteria. */
@vardata GenFileSelectorMask ATTR_GEN_FILE_SELECTOR_NAME_MASK;
/* Virtual Root
* This vardata field defines a "virtual root" for the file selector. The
* user will not be allowed to navigate above the "virtual root" except
* with the Change Drives popup list, if available. If the Change Drives
* list is used, the virtual root is afterwards ignored. */
@vardata GenFilePath ATTR_GEN_FILE_SELECTOR_VIRTUAL_ROOT;
/* Scalable UI Support
* This hint is used to support scalable UI within the File Selector based
* on the application's features (MSG_GEN_APPLICATION_GET_APP_FEATURES).
* This hint takes an array of GenFileSelectorScalableUIEntry structures.
* Typically, one element will have GFSSUIC_SET_FEATURES_IF_APP_FEATURE_ON,
* and one element will have GFSSUIC_SET_FEATURES_IF_APP_FEATURE_OFF.
* The structures are defined below. */
@vardata GenFileSelectorScalableUIEntry HINT_FILE_SELECTOR_SCALABLE_UI_DATA;
/* The structures for the above hint are given below.
* GenFileSelectorScalableUIEntry is a structure with three fields; each
* element in the array is one of these structures.
* GenFileSelectorScalableUICommand is the type of the first field.
* If the data in GFSSUIE_appFeature is true according to the type in
* GFSSUIE_command, then the features in GFSSUIE_fsFeatures will be set
* accordingly. */
typedef ByteEnum GenFileSelectorScalableUICommand;
#define GFSSUIC_SET_FEATURES_IF_APP_FEATURE_ON 0
#define GFSSUIC_SET_FEATURES_IF_APP_FEATURE_OFF 1
#define GFSSUIC_ADD_FEATURES_IF_APP_FEATURE_ON 2
#define GFSSUIC_SET_FEATURES_IF_APP_LEVEL 3
#define GFSSUIC_ADD_FEATURES_IF_APP_LEVEL 4
typedef struct {
GenFileSelectorScalableUICommand GFSSUIE_command;
WordFlags GFSSUIE_appFeature;
FileSelectorAttrs GFSSUIE_fsFeatures;
} GenFileSelectorScalableUIEntry;
/* Number of files
* This hint determines the number of files that are visible at once. */
@vardata word HINT_FILE_SELECTOR_NUMBER_OF_FILES_TO_SHOW;
/* File List Width
* This hint defines the width of the file list. The data is a number of
* average-width characters, up to a maximum of 255.
@vardata word HINT_FILE_SELECTOR_FILE_LIST_WIDTH;
Matching a File's Geode Attributes
Matching a File's File Attributes
Searching Via Callback Routine
GEOS SDK TechDocs
|
|
|
2 File Selector Basics
|
4 File Selector Use