> Hi there, I saw on your post on palm-dev-forum volunteering your help
> for novice developers. I'm sure you can probably answer my question
> while sleeping.
:))
> Is there anyway to tell if a particular field has focus or not? I do not
> want to set the focus to a field.
>
> The SDK reference alludes to peeking at the FieldAttrType structure,
> specifially <UInt16 hasFocus :1>
>
> My C is bad. How do I poll the value of <hasFocus>?
{
FormType *frm;
UInt16 objectIndex;
frm = FrmGetActiveForm();
objectIndex = FrmGetFocus(frm);
// does something have focus?
if (objectIndex != noFocus) {
UInt16 frmObjID = FrmGetObjectId(frm, objectIndex);
// comare "frmObjID" to your resource constants..
//
// ie: if (frmObjID = myFieldID)
}
}
that will tell you what object has the focus. but, if you want to
poll for focus, why not just catch a focus event when it occurs?
unfortunately, the Palm Computing Platform does not allow this
easily, so.. you need to be smart about it.
you can either poll the "object", or.. think about how something
gets focus :)) if you are dealing with a field, the field must
normally get tapped by the user - so you can catch the "fldEnterEvent"
and flag it.
however, you should also remember focus can occur when you call
FrmSetFocus() - so you should also be aware of this. more than one
way to skin a cat, but this should get you started.
cheers
// az
[EMAIL PROTECTED]
http://www.ardiri.com/ <--- free games!
+46 70 656 1143
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/