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

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

Reply via email to