|
|
An option is an attribute whose value may
be either on or off.
The current release of ETI provides the item option O_SELECTABLE.
(In the future, ETI may provide additional options.)
Setting the O_SELECTABLE option lets your user select the item.
By default, O_SELECTABLE is set for every item.
Function set_item_opts
lets you turn on or turn off this and
any future options for an item, while item_opts
lets you examine the option(s) set for a given item.
SYNOPSIS
int set_item_opts (item, opts) ITEM item; OPTIONS opts;In addition to turning on the named item options, function set_item_opts turns off any other item options.OPTIONS item_opts (item) ITEM item;
options: O_SELECTABLE
If successful, set_item_opts returns E_OK. Otherwise, it returns the following:
If you turn off option O_SELECTABLE, the item cannot be selected. You might want to make an item unselectable to emphasize certain things your application program is doing. Unselectable items are displayed using the grey display attribute, described in ``Fetching and changing a menu's display attributes''.
Because options are Boolean values (they are either on or off), you use C Boolean operators with item_opts to turn them on and off. Consequently, to turn off option O_SELECTABLE for item i0 and turn on the same option for item i1, you can write:
ITEM * i0, * i1;ETI also enables you to turn on and off specific item options without affecting others, if any. The following functions change only the options specified.set_item_opts (i0, item_opts (i0) & ~O_SELECTABLE); /* turn option off */ set_item_opts (i1, item_opts (i1) | O_SELECTABLE); /* turn option on */
SYNOPSIS
int item_opts_on (item, opts) ITEM item; OPTIONS opts;These functions return the same error conditions as set_item_opts.int item_opts_off (item, opts) ITEM item; OPTIONS opts;
As an example, the following code turns option O_SELECTABLE off for item i0 and on for item i1.
ITEM * i0, * i1;To change the current default to not O_SELECTABLE, you can write eitheritem_opts_off (i0, O_SELECTABLE); /* turn option off */
item_opts_on (i1, O_SELECTABLE); /* turn option on */
/* set current defaults for all new items */orset_item_opts ((ITEM *) 0, item_opts( (ITEM *) 0) & ~O_SELECTABLE);
item_opts_off ((ITEM *) 0, O_SELECTABLE); /* turn default option off */