> In OS 3.3 one can select content of that field, but it won't 
> destroy it.
> In OS 3.5 one can select content and it erases it.
> 
> What can I do?
> They told me to catch penDown event and check bounds...
> I have editable field on form too.
> Is there easy way of sorting this out?

Sure.  There is a way to make sure the penDownEvent doesn't get to the
field.  More on that in a second . . . because I don't really think it is
necessary.  (You brought up a good point and I had to go research it to make
sure my apps weren't going to break :)  

I'm not sure what you mean by "In OS 3.5 one can select content and it
erases it."  I have several read-only fields in an application, and while
you can select text in the fields (and copy it using the command
stroke--bottom-left to top-right), you can't modify any of the text using
graffiti or the stylus (or by pasting using the command stroke and it's
popup menu).  In constructor, I have the Usable flag selected, but the
Editable and Underline flags deselected.  This keeps the users from doing
any editing on those fields.  

If you don't want users to be able to select from the field, take a look at
the following code which should go in the HandleEvent for the form w/
unselectable fields.  NOTE: frmP is a FormPtr set to FrmGetActiveForm ();

case penDownEvent:
        {
                RectangleType    fieldBounds;
                // Get the bounds of the field to disallow access
                FrmGetObjectBounds (frmP, FrmGetObjectIndex (frmP,
MY_UNEDITABLE_FIELD_ID), &fieldBounds);

                // See if the pen has been pressed within that rectangle
                if (RctPtInRectangle (eventP -> screenX, eventP -> screenY,
                    &fieldBounds))
                {
                        // If so, nip it in the bud
                        handled = true;
                }
        }
        break;

Obviously, this only works for one field.  You would have to have multiple
cases, one for each uneditable field on your form.

Cheers,

Dane

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

Reply via email to