Gadgets are nothing more than a rectangular area on the screen. In fact, you can think of a Gadget as a basic building block for other controls (buttons, checkboxes, etc.). In Pre-3.5 versions of Palm OS, you have to map the pen events to the gadget.

To find the bounds of a gadget you use FrmGetObjectBounds() on the gadget and store them in a RectangleType. For example, if you have a gadget MainTestGadget on your MainForm you would do the following:

      RectangleType rectT;
      FormPtr frmP = FrmGetActiveForm();
      ....
FrmGetObjectBounds(frmP, FrmGetObjectIndex(frmP, MainTestGadget), &rectT);

Now if you want to handle a pen tap in the gadget, you would handle penDown events (and/or penMove and penUp events), like the following:

      case penDownEvent:
              if(RctPtInRectangle(eventP->screenX, eventP->screenY, &rectT) {
                  // Do something
              }
              ...

You need to have the call to RctPtInRectangle() so that you can determine that the pen event is happening inside of your gadget and not in some other control (or a random location on the screen).

At 03:15 AM 1/23/2006, "John Rodriguez" <[EMAIL PROTECTED]> wrote:

Is there a reference or sample code for such?

I can't seem to find any, however, I find numerous pointers to doing it for >= 3.5



Thanks.

-John

----
Tom Frauenhofer, [EMAIL PROTECTED]
Palm OSĀ® Certified Developer
http://www.beret.com
My Blog: http://tomfrauen.blogspot.com

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 1/20/2006



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

Reply via email to