GEOS SDK TechDocs
|
|
1 Providing the UI
|
1.2 UI Fetch Routine
Preferences modules present a dialog box to the user. You will need to design the dialog for your module. As you do so, you may find objects of the following classes useful. Each of the following classes is based upon one of the Generic UI classes.
GenClass provides mechanisms by which objects will read and write values to the .INI file. Pref- classes provide further functionality, such as storing an "original" value to revert to if the user decides to Cancel their changes.
The following Pref- classes are available:
PrefDialogClass
as the head of its UI tree--often the subclass intercepts
MSG_GEN_APPLY
to ensure valid user choices and to take other appropriate actions.
GenValueClass
. However, these objects have the ability to reset their values to that originally stored in the .INI file (in case the user wants to cancel). They can handle only word-length values.
GenBooleanGroupClass
with the ability to store an "original" value.
GenInteractionClass
, but also will relay certain messages to its children which GenInteraction would not. Those objects which will need to work with the .INI file should receive these messages, so any Gen- objects which will work with the .INI file and any Pref objects should be grouped under PrefInteractions instead of GenInteractions.
GenTextClass
, except that it will load and save its value based upon that stored in the .INI file.
PrefControlClass
PrefClass
and
GenControlClass
.
PrefTimeDateControlClass
PrefClass
is something like
GenClass
--while never used directly, it is the superclass of all the other Pref- classes, and sets up several of the mechanisms which all will use.There aren't any special restrictions on what sorts of objects appear in the UI tree of a Preferences module. However, the following rules will prove useful in constructing modules that correctly write their data to the .INI file and have a look and feel consistent with existing modules. For an example, see Pref Module UI Framework .
Code Display 22-1 Pref Module UI Framework
@object MPMDialogClass MPMRoot = {
GI_states = @default & ~GS_USABLE;
GI_comp = @MPMTitleGroup, @MPMOtherStuff;
HINT_INTERACTION_SINGLE_USAGE;
HINT_INTERACTION_COMPLEX_PROPERTIES;
HINT_ORIENT_CHILDREN_VERTICALLY;
HINT_LEFT_JUSTIFY_CHILDREN;
ATTR_GEN_HELP_CONTEXT = "myPrefModule";
ATTR_GEN_INIT_FILE_CATEGORY = "myPref";
}
@object GenInteractionClass MPMTitleGroup = {
GI_comp = @MPMTitle, @MPMHelp;
HINT_ORIENT_CHILDREN_HORIZONTALLY;
HINT_EXPAND_WIDTH_TO_FIT_PARENT;
}
@object TitledGlyphClass MPMTitle = {
GI_visMoniker = list {
@FontTextMoniker, @FontLCMoniker, @FontLMMoniker, @FontLCGAMoniker
}
}
@object GenTextClass MPMHelp = {
GI_attrs = @default | GA_READ_ONLY;
GTXI_text = "Do such and such to configure your so and so.";
HINT_EXPAND_WIDTH_TO_FIT_PARENT;
/* Might want HINT_MINIMUM_SIZE */
}
GEOS SDK TechDocs
|
|
1 Providing the UI
|
1.2 UI Fetch Routine