paul at researchware.com
Thu Jul 13 18:01:23 EDT 2023
On 7/12/2023 6:21 PM, Paul Dupuis via use-livecode 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.
Thanks to Richmond, Mark, and Jacque for your responses.
So, I actually need to note the position of the selected (i.e. char x to
y) rather than the selected text itself.
Indeed, if you have text highlighted in a lock, scrolling text field
(autohilite on) and click a button, the highlight does not go away.
However, if you click on another field it does. I need a solution where
the highlight appears to remain in the primary "Content" field no matter
what else the user clicks on in terms of other UI actions.
So, it still seems the "best" way to do this is using the on
selectioChanged message and getting the selectedChunk and if not empty
and word 2 is not > word 4 (insertion point), then save word 2 as the
start and word 4 as the end and change the background color of the
selected range to the highlight color, clearing another of background color
This makes it appear that the selection remains, updates it when the use
makes a new selection, but sacrifices any other use of background color
for the text in the field (which I can live with)
More information about the use-livecode