Field highlited

Mark Smith marksmithhfx at
Thu Jul 13 14:18:59 EDT 2023

Hi Paul, try “the selectedText".

Create a scrolling text field, call it fld1, and put a large amount of text in it.
Create 2 buttons: one with “on mouse down, answer “Hello World” and the other with “on mouse down, answer the selectedText of field “fld1”

Now highlight an area of text in fld1. Click either button, the highlight in the text does not go away. The first button responds with “Hello World” and the second responds with the highlighted text in fld1.

I am using LC 10 if that makes a difference, although just tested in 9.6.8 and it worked there as well. 


> On 12 Jul 2023, at 11:21 pm, Paul Dupuis via use-livecode <use-livecode at> wrote:
> I have a LC9 field object - just a scrolling field (not a list field) with a lot of text. The user selects some text and then click a button near the field. I want the selection to remain highlighted, but when you click outside the field the highlight goes away.
> Any simple solutions to this. Some property I am just blanking on? In another app, I've used the "selectionChanged" message to (1) set the background color of the selection to a highlight color and store the start and end characters as custom properties of the field. I'm hoping there is an easier way I am just missing.
> OR
> There should be a feature enhancement: set the preserveHighlight of field X to true
> That keeps the highlighted selection unless or until you make a new one in that field
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list