The selectedText for controls without focus

Bob Sneidar bobsneidar at
Fri Feb 24 11:50:27 EST 2017

Hi all. 

The Short Version:

Is there a way to get the hilited text for a control without focus?

The Long Version:

I use a method for forms (by which I mean LC cards with fields and buttons on them) where I set the traversalOn to false on all the fields when I am simply viewing the data, so that the user will not be led to believe they are making actual edits to the database simply because they changed the value of a field. 

I have new/edit buttons that then set the traversalOn accordingly. But when not editing (view mode no traversalOn) users can still hilited text in a field. Of course, the field does not receive focus (no focus border) but it is clear that a selection has been made. 

My question is, HOW DO I GET THAT SELECTION? I want the user to be able to copy text in view mode, but unless the control has traversalOn set to true, AND the control has focus, none of the text selection commands seem to work. Not only that, none of the field handlers work. OpenField, selectionChanged, nothing. 

It would be better i suppose if the end user was unable to even select text in this mode (I can accomplish that with lockText) that for the text to be hilited, but nothing can be done with it. I can work around this I am sure, but it will require a lot of factoring. 

My question is, is there a way to get that visible selection? The engine is obviously hiliting it. 

Bob S

More information about the use-livecode mailing list