Config Library: 4.3 Object Class Reference: PrefItemGroupClass

Up: GEOS SDK TechDocs | Up | Prev: 4.2 PrefValueClass | Next: 4.4 PrefStringItemClass

This class acts like GenItemGroupClass , but has extended functionality for reading/writing strings to the .INI file. When the user triggers the dialog's Apply trigger (when the PrefItemGroup receives a MSG_META_SAVE_OPTIONS ), the PrefItemGroup will respond by writing out strings based upon which of its children items are presently selected. These strings can be taken from the items' monikers or from strings used with PrefStringItemClass objects.

When loading options, if either the PIFF_USE_ITEM_MONIKERS or PIFF_USE_ITEM_STRINGS is set for the item group, then it will select its children based on the strings stored in the .INI file.Otherwise, the item group will default to the GenItemGroupClass functionality, which uses the identifier of the items as a basis for selection.

Code Display 22-6 PrefItemGroupClass Instance Data

@instance PrefInitFileFlags  PIGI_initFileFlags = 0;
typedef ByteFlags  PrefInitFileFlags;
#define  PIFF_USE_ITEM_STRINGS 0x80
/* 
 * If set, then the item group's children must be of class PrefStringItemClass,
 * and their strings will be used to interact with the .INI file. */
#define PIFF_USE_ITEM_MONIKERS 0x40
/* If set, the monikers of the items are used to interact with the .INI file. */
#define PIFF_APPEND_TO_KEY 0x20
/* If set, the strings in this list will be ADDED 
 * to strings that may already exist for this key */
#define PIFF_ABSENT_KEY_OVERRIDES_DEFAULTS 0x10
/* If set, an absent key for the item group will cause it to
 * behave as if an empty key were in the .INI file, effectively
 * overriding any default values stored with the group when it was
 * compiled. Used primarily by those groups where one subclasses
 * MSG_PREF_STRING_ITEM_CHECK_IF_IN_INIT_FILE_KEY to determine the
 * initial setting, rather than looking in the .INI file. */
@instance word PIGI_originalSelection = 0;
@instance word PIGI_originalNumSelections = 0;
@instance byte PIGI_suspendCount = 0;
/* When suspend count is nonzero, the item group won't update text objects, nor
 * will it enable/disable objects when the selection changes. */
@vardata PrefEnableData ATTR_PREF_ITEM_GROUP_ENABLE;
/* allows setting up an object to be enabled/disabled when
 * settings are made in the item group */
typedef struct {
	word 		 PED_item; 		/* Identifier of the item that controls
					 * enabling/disabling of object. If this
					 * is GIGS_NONE, then the action will be
					 * performed if no items are selected. */
	ChunkHandle 		PED_lptr; 		/* Object to be enabled/disabled */
 	PrefEnableFlags 		PED_flags;
}  PrefEnableData;
typedef ByteFlags  PrefEnableFlags;
#define  PEF_DISABLE_IF_SELECTED 0x80
/* Disable the object if the associated item is selected,
 * otherwise do the opposite. */
#define PEF_DISABLE_IF_NONE 0x40
/* If this flag is set, then the PED_item field is ignored.
 * Instead, the item group will disable the specified object if
 * no items are selected -- or if there are no items in the list. */
@vardata word  ATTR_PREF_ITEM_GROUP_OVERRIDE;
/* This attribute is used to specify an item which will act
 * as an OVERRIDE for all other items (in a non-exclusive
 * item group).
 *
 * When the specified item is SELECTED, then all other items are DE-SELECTED.
 * When any other item is SELECTED, the override item is DE-SELECTED.
 * If all items are DE-SELECTED, the override item becomes SELECTED */
@vardata ChunkHandle ATTR_PREF_ITEM_GROUP_TEXT_DISPLAY;
/* chunk handle of a GenText object that will be updated
 * with the moniker of the currently selected item on APPLY/RESET. */
@vardata ChunkHandle ATTR_PREF_ITEM_GROUP_STATUS_TEXT;
/* chunk handle of a GenText object that will be updated every
 * time this object receives a MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG. */
@vardata char ATTR_PREF_ITEM_GROUP_EXTRA_STRING_SECTION[];
/* If a string is given -- the string will always be written
 * out as the FIRST string section for the .INI file key. For
 * example, the "Memory" item group uses this to always insert
 * "disk.geo" whenever writing out the memory types. Note:
 * this item is only written if the item group has either the
 * PIFF_USE_ITEM_MONIKERS or PIFF_USE_ITEM_STRINGS set. */

MSG_PREF_ITEM_GROUP_SET_ORIGINAL_SELECTION

void 	MSG_PREF_ITEM_GROUP_SET_ORIGINAL_SELECTION(
word selection);

Set the "originalSelection" field of the item group. Also, sends MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION to superclass. This message can only be used with exclusive item groups--for other types, use the GenItemGroup messages, and then send the object MSG_PREF_SET_ORIGINAL_STATE .

Source: Anywhere.

Destination: An exclusive PrefItemGroup.

Parameters: selection Which item to select.

Return: Nothing.

Interception: Unlikely.

MSG_PREF_ITEM_GROUP_GET_SELECTED_ITEM_TEXT

word 	MSG_PREF_ITEM_GROUP_GET_SELECTED_ITEM_TEXT(
        char 	*buffer,
        word 	bufSize);

This message returns the text in the moniker of the selected item. The value returned is the number of characters in the string. If nothing is selected, the value returned is zero.

MSG_PREF_ITEM_GROUP_GET_ITEM_MONIKER

word MSG_PREF_ITEM_GROUP_GET_ITEM_MONIKER(@stack 
        char 	*buffer,
        word 	bufSize,
        word 	identifier);

This message retrieves the text in the moniker of one of the items of a PrefItemGroup. This works for dynamic list subclasses as well. The message returns the number of characters in the returned text.

Parameters: buffer Buffer in which to return moniker text.

bufSize
Size of buffer.
identifier
Identifier of item whose moniker should be returned.

Return: Size of item's moniker.

MSG_PREF_ITEM_GROUP_UPDATE_TEXT

void MSG_PREF_ITEM_GROUP_UPDATE_TEXT(
        ChunkHandle 		textObject);

This message updates the specified text object with text of the currently selected item. The PrefItemGroup sends this to itself in conjunction with either ATTR_PREF_ITEM_GROUP_TEXT_DISPLAY or ATTR_PREF_ITEM_GROUP_STATUS_TEXT. By default, this message will also cause the text object to send out its status message.

Source: Self.

Destination: Self.

Interception: Default behavior is to fetch the moniker of the current selection, and sent that to the text. The subclasser can use different text, if desired.


Up: GEOS SDK TechDocs | Up | Prev: 4.2 PrefValueClass | Next: 4.4 PrefStringItemClass