"select text of" won't select text but Rev docs says it does. (was openField....)
J. Landman Gay
jacque at hyperactivesw.com
Sat Dec 4 13:49:53 EST 2004
On 12/3/04 8:23 PM, runrev at jkvaldez.com wrote:
> Sorry to resubmit this topic, but the subject I had used earlier is
> misleading. This should make the problem more clear.
>
> The built-in rev dictionary (located in Help: Objects > Field > Message >
> openField) says you can select the entire text in a field by:
>
> on openField -- when clicking in the field, select all its text
> select text of the target
> end openField
>
> This doesn't work for me. Create a new stack, drag out a scrolling text
> field, enter the above handler/script. It works only if I tab into the
> fld. But if I click it, I can see it briefly hilite the text but then it
> immediately sets the insertion point where I clicked--so no text is
> selected.
>
> I'm using OSX 10.3, rev 2.5. I didn't see anything in bugzilla or posted
> in the list. Anyone experiencing this?
Yes, but it isn't a bug, it is the natural result of the message sending
hierarchy. When the field opens, the handler runs and selects all the
text, but then Rev's built-in behavior sets the cursor in the text,
which deselects it and places the insertion point at the location of the
click.
I was able to get the text to remain selected by changing the handler
name from "openfield" to "selectionchanged":
on selectionChanged
select text of the target
end selectionChanged
This isn't ideal, since any time the user clicks in the field -- even if
the field is already open for editing -- the text will become selected.
This only happens every other time though, since if the user clicks a
second time within the fully-selected text, the text deselects and the
insertion point is placed (just like what happens in your openField
handler.)
Depending on how your stack works, this may be good enough. If not,
write again and maybe we can brainstorm.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list