Hi Oliver,
At 12:00am -0800 00-11-14, Palm Developer Forum digest wrote:
>Subject: MenuHandleEvent is eating messages
>From: Oliver King-Smith <[EMAIL PROTECTED]>
>Date: Mon, 13 Nov 2000 13:25:27 -0800
>X-Message-Number: 50
>
>This message is long but broken into the following parts
>
>* Code that fails <1% of the ime
>* Message dump for when the code fails
>* System calls when the code works
>* System calls when the code fails
>* Other information
Thanks for the very detailed problem report - with this information,
it took all of two minutes to locate and fix the bug. Basically the
menu command bar code isn't verifying that the event is a keydown
event before checking for the command character.
The solution is to add a MemSet call:
EventType event;
MemSet(&event, sizeof(EventType), 0); // Clear out event.
event.eType = PART_INDEX; // PART_INDEX = 0x6015
MemMove( event.data.generic.datum, &selection, sizeof(UInt16) );
EvtAddEventToQueue( &event );
In general you should _always_ clear out an event record before
filling it in and posting it. This extends to any other Palm
structure that you initialize and then pass to the OS. The reason is
that any currently undefined fields (including padding fields) might
wind up becoming real fields in the future, and the OS would like to
be able to depend on them being set to zero.
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/