RctPtInRectangle() is very handy for just such an occasion.

What I've done with my gadgets is add the test to see if a tap occurred
within its bounds (using the mentioned function in the form event handler)
and then branch off to my appropriate gadget handler.  The same principle
can be applied to any event your gadget needs.  You will have to keep track
of which of your on screen gadgets have 'focus' so you can route other
events to the correct handler.
I have written a gadget that uses callback functions so I add a call to the
gadget event handler before processing the form events.  This way, it can
detect pen taps and my form handler only needs to make one call.  I have not
tried it with multiple gadgets on the screen at the same time but I guess if
you allow each gadget to peek at the event before your form, it could work.

-----Original Message-----
From: Glenn Bachmann <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, November 18, 1999 10:58 AM
Subject: Gadgets and events - followup question


>A followup to Pete Angiuoli's question on gadgets:
>
>I think I understand that if I put an input field on a form, that the form
>handler does not "see" low-level events such as pen up/down. Through some
>magic, they get routed directly to the input field, and handled by code in
>the Palm OS handler for input fields. There is no special routing that the
>form handler has to do to say to the input field that a pen was tapped.
>
>I think I also understand that if I write a gadget, that it does not
>magically receive events that happen within its client area rectangle, it
>is the responsibility of the parent form to figure out that a pen down that
>happened at coordinates 100,50 should be handled by the gadget at that
>location. So I wind up with code in my form handler that looks like this:
>
>-Get a pen event
>-Determine the location of the pen tap
>-Figure out if there is a custom gadget that is "underneath" that x/y
location
>-Hand the event to some piece of code that is responsible for handling a
>pendown in the context of the gadget (ex. change the cursor position).
>
>You can see where this becomes unwieldy if, say, I've written a "super
>input field" gadget, and I've got 16 of them on my form.
>
>So my question is, how is it that pen events and such are automatically
>routed to the "built-in" UI elements? Is there a way for my own "custom
>gadgets" to participate in this mechanism, such that my parent form handler
>logic does not have to manually route these events? Under windows, because
>of the parent-child relationship of windows, this is automatically handled
>by the UI element that "has the focus".
>
>Assuming I'm not just hopelessly confused, any insight on this would be
>helpful to us.
>
>Thanks!
>
>
>Glenn Bachmann
>Bachmann Software and Services, LLC
>http://www.bachmannsoftware.com
>Software for Handheld & Wireless Computing, Windows and the Internet
>Authors of "Palm Programming", published by Macmillan/Sams, and home of
>Bachmann Print Manager, the only graphical printing solution for the Palm
>Computing Platform
>


Reply via email to