GenClass: 4.3 Modifying GenClass Instance Data: Managing Keyboard Accelerators

Up: GEOS SDK TechDocs | Up | Prev: 4.2 Managing Visual Monikers | Next: 5 Generic Trees
MSG_GEN_GET_KBD_ACCELERATOR, MSG_GEN_SET_KBD_ACCELERATOR, MSG_GEN_CHANGE_ACCELERATOR 

Keyboard Accelerators provide keyboard shortcuts for heavily used application functions. For complete information on valid GI_kbdAccelerator instance data and the functionality those data provide, see Keyboard Accelerators .

MSG_GEN_GET_KBD_ACCELERATOR returns a word of data specifying the current keyboard accelerator, if any, for the object the message is sent to.

MSG_GEN_SET_KBD_ACCELERATOR sets the keyboard accelerator of the object the message is sent to. The message must pass the keyboard accelerator to use along with a VisUpdateMode . If you wish to remove a keyboard accelerator from an object, pass this message with a keyboard acclerator of zero.

MSG_GEN_CHANGE_ACCELERATOR changes the keyboard accelerator using a low-level replace operation.

MSG_GEN_GET_KBD_ACCLERATOR

word	MSG_GEN_GET_KBD_ACCELERATOR();

This message returns the object's current GI_kbdAccelerator. The message returns a word-length data structure ( KeyboardShortcut ). You can then manipulate or use this word of data to set other object's keyboard accelerators. Make sure that you do not have two objects sharing the same keyboard accelerator.

Source: Unrestricted.

Destination: Any generic object.

Return: KeyboardShortcut of the generic object (in GI_ kbdAccelerator ).

Interception: Generally not intercepted.

MSG_GEN_SET_KBD_ACCELERATOR

void	MSG_GEN_SET_KBD_ACCELERATOR(
        word		accelerator,
        VisUpdateMode		updateMode);

This message sets the GI_kbdAccelerator of the object the message is sent to.

Source: Unrestricted.

Destination: Any generic object.

Parameters: accelerator KeyboardShortcut to set GI_ kbdAccelerator of the generic object to.

updateMode
VisUpdateMode to determine when redrawing occurs.

Interception: Generally not intercepted.

Code Display 2-19 Using a Keyboard Accelerator

@kbdAccelerator ShortcutOne = ctrl shift `k';
	/* @specificUI keyword needed to use DELETE key */
@kbdAccelerator ShortcutTwo = @specificUI ctrl DELETE;
@object GenTriggerClass MyTrigger = {
    GI_kbdAccelerator = ShortcutOne;				/* sets accel to "ctrl shift `k'" */
}
@object GenTriggerClass MyOtherTrigger = {
	GI_kbdAccelerator = ShortcutCopy;				/* Copies "ctrl shift `k'" to
					 * MyOtherTrigger */
}

MSG_GEN_CHANGE_ACCELERATOR

void	MSG_GEN_CHANGE_ACCELERATOR(
        word	bitsToClear,
        word	bitsToSet);

This message changes the keyboard accelerator using constants defined in the input library. In most cases, use MSG_GEN_SET_KBD_ACCELERATOR instead. MSG_GEN_CHANGE_ACCELERATOR is useful in some cases where you wish to tinker slightly with the keyboard shortcut's usage (as in a case where an accelerator of ctrl z should change to alt z in the duplication of a template object).

Source: Unrestricted.

Destination: Any generic object.

Parameters: bitsToClear KeyboardShortcut and/or VChar to clear.

bitsToSet
KeyboardShortcut and/or VChar to set.

Interception: Generally not intercepted.


Up: GEOS SDK TechDocs | Up | Prev: 4.2 Managing Visual Monikers | Next: 5 Generic Trees