Have a look at the definitions of the Palm events in the header file. The
events are a fixed size. You can just define your own structure(s) using
whatever unions etc, as long as the first bytes map onto the Palm event
bytes, and the data bytes are your definition (and fit into the number of
available bytes).

Then you can cast any event pointer to be a pointer to your event type and
access the data accordingly.

// Definition of your event type.
typedef struct {
   // These must map onto the Palm event type.
   eventsEnum  eType;
   Boolean        penDown;
   UInt8          tapCount;
   Int16          screenX;
   Int16          screenY;

   // You don't actually need to do this union, if you never use this type
to create an event.
   union {
      struct _GenericEventType  generic;

      // Here is your stuff. May be a struct, union, etc. Ensure it is no
bigger than _GenericEventType.
      struct ctlEnter {
         UInt16            myFirstInfo;
      } myEventData;
   } data;
} MyCustomEventType;

// Access your fields.
((MyCustomEventType *)event)->data.myEventData.myFirstInfo

Matt

>Thanks for the help.  I figured this much out already (I did a poor job of
>asking the right question).
>
>How do I send data with a custom event.  I don't see anyplace in the
>EventType structure to pass custom data with the event.  I could always use
>one of the unioned structures in place, but, from a code point of view it
is
>not going to make much sense to the next guy who comes through and has to
>maintain the code!!!
>
>For example:
>   switch( event->eType )
>        case MyCustomEvent:
>                do something with event->data.frmOpen.formID;       // Why
>use frmOpen with MyCustomEvent type????
>
>Any suggestions on the cleanest way to do this???
>
>Thanks again,
>
>Brad Figler




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to