That is about the limit. One thing you can do is create a data structure less than or
equal to the amount of the generic structure
(16 bytes) and typedef it in. It would go something like this.
typedef struct custom_data
{
int a, b;
char code[4];
}CUSTOM_DATA;
#define CUSTOM_EVENT (enum event) (firstCustomEvent)
void PostCustomEvent(CUSTOM_DATA *pData)
(
EventType event;
event.eType = CUSTOM_EVENT;
MemMove((void *) &(event.data.generic), (void *) pData, sizeof(CUSTOM_DATA)); //
less than 16 bytes
EvtAddUniqueEventToQueue(&event, 0, true);
}
and in your event handler you would do
void GetCustomEventData(CUSTOM_DATA *pData, EventType *pEvent)
{
MemMove((void *) pData, (void *) &(event.data.generic), sizeof(CUSTOM_DATA));
}
It is pretty blunt, but then I have found the elegant approach isn't very effective on
the PalmOS.
Steve
Rhys Arkins wrote:
> Thanks for everyone's replies. I see now that it is possible to define
> custom events, but is it possible to have a custom "data" field in the
> EventType structure? Is the only way to use the "generic" struct inside the
> data union?
>
> thanks again
> Rhys
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/