RE: Selecting Noneditable field
Good point. If all the fields in the form are non-editable, then there is no difference. Otherwise, there is this minor difference. -- Peter Epstein -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: Selecting Noneditable field
> -Original Message- > You shouldn't have to go through so much work to keep text from being > selected in a non-editable field. Just catch the > fldEnterEvent and return > with handled = true. No need to mess with bounds checking, > since the field > already does this for you. If all the fields on the form are > non-editable, > then you don't even have to check which field is being entered. Agreed, although, if you want to make the user's experience of tapping on an uneditable field the same as tapping on a blank area of the form, you need to handle the penDown. For example: If you have the insertion point in an editable field, and then you tap on an uneditable field, the insertion point will disappear, whereas tapping on the background of the form will leave the insertion point in the editable field. Handling the penDownEvent treats a user tap on an uneditable field as though it was on a blank area of the form (ie: it acts just as though you had called WinDrawChars instead of used a field). Also . . . Anyone else notice that the underlining of uneditable fields is different from that of editable fields on 256 color modes, and 4-bit grey modes? -DGA -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: Selecting Noneditable field
You shouldn't have to go through so much work to keep text from being selected in a non-editable field. Just catch the fldEnterEvent and return with handled = true. No need to mess with bounds checking, since the field already does this for you. If all the fields on the form are non-editable, then you don't even have to check which field is being entered. -- Peter Epstein -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: Selecting Noneditable field
> 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: { RectangleTypefieldBounds; // 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/