--- In [EMAIL PROTECTED], Ben Combee <[EMAIL PROTECTED]>
wrote:
>
> >I *learned from example* using the Scrollbar routines from the
PalmOS4
> >source code, and implemented a SclHandleEvent for my own custom
scrollbar
> >control. [This is for a Satellite Forms extension.] This has
worked great
> >under previous PalmOS versions, but now that a version of SatForms
that
> >supports PalmOS 5 is finally available, I find that the code
doesn't quite
> >work on the OS5 Simulator.
> >
> >Specifically, when I monitor the event queue (nice feature in
PalmSim!), I
> >find that when I tap on the scrollbar, the expected sclEnterEvent
is not
> >generated, but a nilEvent is queued instead. Thus, the scrollbar
doesn't
> >act on the pen taps.
> >
> >Strangely, if I use a status display function to show me what the
eventtype
> >of my new event is, it is indeed a sclEnterEvent as expected.
But, the
> >PalmSim event monitor shows (and the OS sees) only a nilEvent.
> >
> >Here's the snippet of code I am using in the SclHandleEvent:
> >
> > if (event->eType == penDownEvent)
> > {
> > if (RctPtInRectangle (event->screenX, event->screenY, &bar-
>bounds))
> > {
> >// newEvent = *event;
> > MemSet (&newEvent, sizeof(EventType), 0);
> > newEvent.eType = sclEnterEvent;
> > newEvent.data.sclEnter.scrollBarID = bar->id;
> > newEvent.data.sclEnter.pScrollBar = bar;
> > EvtAddEventToQueue (&newEvent);
> > handled = true ;
> >
> > MyShowStatus("sclEvt type:", newEvent.eType);
> >
> > }
> > }
> >
> >
> >Can anyone suggest why this sclEnterEvent is being turned into a
nilEvent in
> >the queue, and better yet what I can do to work around the problem?
>
> In Palm OS 5, events are converted to an internal format, then
converted
> back to 68K format when passed to 68K callback functions.
>
> Its possible that if an event is ill-formed, that it will be turned
into a
> nil event by the OS. I'm curious, how are you getting "bar->id"?
I would
> think that could possibly not get a valid value on Palm OS 5, since
you
> shouldn't be directly accessing the internals of Palm OS data
> structures. However, the actual release ROM and release device
might allow
> this.
>
> --
> Ben Combee <[EMAIL PROTECTED]>
> CodeWarrior for Palm OS technical lead
> Palm OS programming help @ www.palmoswerks.com
Ben,
Thanks for the suggestion. I had previously tried setting the
newEvent.data.sclEnter.scrollBarID to my defined rsrc name as well,
since my testing app only has a single scrollbar and I know it is the
right objectid if hardcoded. I had also added a status display
function to show me the id in the newEvent like this:
MyShowStatus("SclEvt id:", newEvent.data.sclEnter.scrollBarID);
and it was indeed returning the right id.
So, just now I tried leaving the scrollBarID at 0, and I still get
the nilEvents coming up in the queue.
Well, I guess since I've got the source code and can modify it to my
liking, I could try converting all the code to userevents rather than
sclevents. Perhaps that would allow me to keep pace with OS5 (pun
intended).
David Thacker
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/