GEOS SDK TechDocs
|
|
2.3 Messages to Handle
|
3 File Selector Instance Data
Although the basics are all covered under the previous sections and you need nothing more to add a File Selector to your application, you will probably want to customize it somewhat. Typical simple customizations include limiting the types of files displayed, restricting the search to a single directory or volume, limiting the display to directories only (no files), and limiting the search to only those files with a given filename extension.
Each of these is shown in the displays following this section. Notice that the only changes you need to make to implement any of these customizations is to the File Selector's Goc code. You will not need to handle any other messages or add other code to your application. These customizations are shown in Display Only Directories through Show Only Files with a Given Filename Extension and show how to do the following (you may apply any combination):
tokenChars
and
tokenID
.These are not the only customizations you can make. Although they will satisfy the needs of the large majority of applications, you can change the File Selector's searches any way you want (you can even set up a callback routine to filter every single file or directory). The remainder of this chapter explains in detail the different things you can do to the File Selector.
Code Display 14-4 Display Only Directories
@object GenFileSelectorClass DirectorySelector = {
GFSI_destination = process;
GFSI_notificationMsg = MSG_MY_APP_DIRECTORY_SELECTED;
GFSI_fileCriteria = FSFC_DIRS;
};
Code Display 14-5 Limit the Search to a Single Directory
@object GenFileSelectorClass SingleDirFileSelector = {
GFSI_destination = process;
GFSI_notificationMsg = MSG_MY_APP_FILE_SELECTED;
GFSI_attrs = FSA_HAS_FILE_LIST;
GFSI_fileCriteria = FSFC_NON_GEOS_FILES | FSFC_GEOS_EXECUTABLES
| FSFC_GEOS_NON_EXECUTABLES;
ATTR_GEN_PATH_DATA = {0, DIRECTORY};
/* Limit the display to this standard directory.
* Note that paths may be given; relative paths are taken as
* relative to the specified standard path. This attribute
* is defined in GenClass. */
};
Code Display 14-6 Show Hidden Files As Well As Normal Files
@object GenFileSelectorClass HiddenFileSelector = {
GFSI_destination = process;
GFSI_notificationMsg = MSG_MY_APP_FILE_SELECTED;
/* Specify that FA_SYSTEM files are the only ones not to be displayed. */
ATTR_GEN_FILE_SELECTOR_FILE_ATTR = { 0, FA_SYSTEM};
};
Code Display 14-7 Show Only Files Created by a Given Geode
@object GenFileSelectorClass CreatorFileSelector = {
GFSI_destination = process;
GFSI_notificationMsg = MSG_MY_APP_FILE_SELECTED;
ATTR_GEN_FILE_SELECTOR_CREATOR_MATCH = {{"CRTR"}, 0};
};
Code Display 14-8 Show Only Files with a Given Filename Extension
@object GenFileSelectorClass ExtensionFileSelector = {
GFSI_destination = process;
GFSI_notificationMsg = MSG_MY_APP_FILE_SELECTED;
ATTR_GEN_FILE_SELECTOR_NAME_MASK = {"*.BAT"}; /* Show files ending with BAT. */
/* Note that the mask is case sensitive. This means that the mask must be
* in upper case to match DOS files. */
};
GEOS SDK TechDocs
|
|
2.3 Messages to Handle
|
3 File Selector Instance Data