Monday, August 20, 2007

How to programmatically open the find dialog

To programatically open the find dialog, you need to add a key down event to the eventqueue using the EvtAddEventToQueue function. Here is a code example for adding an eventto the queue:

/* Emulate a keydown event */
static void AddKeyDownEvent(WChar character)
{
EventType theEvent;
MemSet(&theEvent, sizeof(EventType), 0);

/* Create the key down event */
theEvent.eType = keyDownEvent;
theEvent.data.keyDown.chr = character;
theEvent.data.keyDown.keyCode = 0;
theEvent.data.keyDown.modifiers = commandKeyMask;

/* Add the event to the event queue */
EvtAddEventToQueue(&theEvent);
}
In this case, pass in a character code of vchrFind Some other possible values that youmay find useful for the character argument are:


vchrMenu - Shows the menu bar
VchrCommand - Simulate a command stroke
vchrLaunch - Opens the launcher
vchrCalc - Opens the calculator
VchrRonamatic - Simulates a stroke from the graffiti writing area to the top of the screenvchrGraffitiReference - Opens the graffiti reference
dialogvchrLock - Locks and powers off the unit
vchrBacklight - Toggles the state of the backlight

For a complete listing see Chars.h.

No comments: