Correction: 

on openField
   put long id of the target into pField
   if the savedChunk of pField is not empty then
      put the savedChunk of pField into tSelection
      select tSelection
   Set the savedChunk of pField to empty
   end if
   pass openField
end openField


> On Jul 13, 2023, at 10:12 AM, Bob Sneidar <bobsnei...@iotecdigital.com> wrote:
> 
> <sigh>
> Untested
> 
> This in a frontScript: 
> 
> on openField
>   put long id of the target into pField
>   set the selection to the savedChunk of pField — if you want to restore the 
> last selection
>   Set the savedChunk of pField to empty
>   pass openField
> end openField
> 
> on exitField
>   put the long id of the target into pField
>   set the savedChunk of pField to the selectedChunk
>   pass exitField
> end exitField
> 
> Bob S
> 
> 
>> On Jul 13, 2023, at 9:50 AM, William Prothero via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>> 
>> Folks,
>> A possible strategy is to change the color of a line in a field, when it is 
>> selected. There would need to be a script that could simply returns the 
>> content of a line of a specified color, changes the color to "unselected", 
>> or whatever your need requires. You could have multiple lines selected, and 
>> other variations as needed.
>> 
>> Just thinking.
>> Bill
>> 
>> William A. Prothero, PhD
>> Prof Emeritus, Dept of Earth Science
>> University of California, Santa Barbara
>> 
>>> On Jul 13, 2023, at 9:06 AM, Craig Newman via use-livecode 
>>> <use-livecode@lists.runrev.com> wrote:
>>> 
>>> Paul.
>>> 
>>> I think that Bob S. is correct. The change in focus is sort of built into 
>>> the engine, and a field cannot “remember” such a thing.
>>> 
>>> A fun kludge would be to create one or more overlays, however you like 
>>> those to look, and apply them to the field of interest. These overlays can 
>>> be managed in terms of their rects, depending on the formatted properties 
>>> of the hilted line or lines. They can be shown and hidden as well.
>>> 
>>> I am struggling not to do this just for fun. So you do it, because I bet 
>>> that the team has bigger fish to fry.
>>> 
>>> Craig
>>> 
>>>> On Jul 13, 2023, at 11:27 AM, Bob Sneidar via use-livecode 
>>>> <use-livecode@lists.runrev.com> wrote:
>>>> 
>>>> I do not see how that could work. In Windows, buttons can have the focus, 
>>>> which means a field would always lose it. 
>>>> 
>>>> What I do when I need something like this is I save the selection (or 
>>>> selectedChunk or some such thing) as a property of the field upon 
>>>> exitField. You could even put that in a frontScript and reference the 
>>>> target. Then in the field script re-select the text upon enterField. 
>>>> 
>>>> Bob S
>>>> 
>>>> 
>>>>>> On Jul 12, 2023, at 3:21 PM, Paul Dupuis via use-livecode 
>>>>>> <use-livecode@lists.runrev.com> 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@lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your 
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your 
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to