The selectedText for controls without focus

Richard Gaskin ambassador at
Fri Feb 24 13:06:16 EST 2017

Bob Sneidar wrote:

 > Enhancement Request 19323 submitted.
 > As to your post, yes the selectedText 'of the field' will work.
 > But a menu command like "Copy" would not know which field was
 > selected. I suppose I could loop through all the fields and get
 > the one which was not empty. I'll play with that a bit.

Did you try it without the "of <field specifier>"?

That should not be needed.

LiveCode allows only one active field selection in non-list fields.

This means that selecting a text run will in any field that allows it 
will cause any other field to lose selection and become the 
selectedField.  This is independent of other properties like lockText, 
and is logically needed to prevent cases where more than one field might 
have a run of text selected.

I've been relying on solid handling of text selections in locked fields 
for years, but just in case I also tested this in v9 right now:

1. Make a field as you describe

2. Make a button with this script:

on mouseUp
    select word 2 of fld 1
end mouseUp

3. Turn off the button's traversalOn property.

That's essential for the same reason this all works:  like most systems, 
LC only has one keyboard-focused object at a time, and if the 
traversalOn is off (why isn't it just called "traversal"?) then clicking 
on it will not take keyboard focus away from other objects, like the 
selection of text runs in fields.

4. Click the button.

5. Paste into any editor and see if it worked.

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for Desktop, Mobile, and Web
  Ambassador at

More information about the use-livecode mailing list