Re: Field highlited
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 > 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
Re: Field highlited
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 > 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 >> 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
Re: Field highlited
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 > 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 >> 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 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
Re: Field highlited
Thank your Bob, Craig, and William for the responses. It appears the way I have done it in the past is the "best" option. I was hoping there was some clever trick I don't know, but it is what it is. I'll do what I have done before. Thanks again. On 7/12/2023 6:21 PM, Paul Dupuis via use-livecode wrote: 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. ___ 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
Re: Field highlited
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 > 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 >> 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 >>> 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 > 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
Re: Field highlited
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 wrote: > > > 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 >> 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 >>> 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 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 >> 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
Re: Field highlited
I just did this: on mouseLeave put the selectedText of fld "f1" into fld "f2" end mouseLeave you can then do whatever you want with your button on the basis of the contents of fld "f2" Best, Richmond. On 13.07.23 20:20, Bob Sneidar via use-livecode wrote: 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 wrote: 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 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 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 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 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 ___ 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
Re: Field highlited
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. Mark > On 12 Jul 2023, at 11: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. > > 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
Re: Field highlited
On 7/13/23 1:18 PM, Mark Smith via use-livecode wrote: Hi Paul, try “the selectedText". Whaddya know...it works! Another way is to turn off traversalOn in the button. That prevents the focus from changing. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ 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
Re: Field highlited
On 7/13/23 2:58 PM, J. Landman Gay via use-livecode wrote: On 7/13/23 1:18 PM, Mark Smith via use-livecode wrote: Hi Paul, try “the selectedText". Whaddya know...it works! Another way is to turn off traversalOn in the button. That prevents the focus from changing. Actually, I've been trying different button and field settings and no matter what I do, the selection doesn't go away It doesn't matter if I click a button or directly on the card. I'm not sure what changed because it didn't used to be that way. LC 9.6.9. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ 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
Re: Field highlited
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) Thanks all, ___ 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
Re: Field highlited
Paul Dupuis 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 https://quality.livecode.com/show_bug.cgi?id=3327 -- Richard Gaskin Fourth World Systems ___ 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
Re: Field highlited
BTW, is there a way of determining the default highlight colour? When I select some text in a field it highlights to a light blue color, but I can’t find where that color is set. Thanks Mark > On 13 Jul 2023, at 11:01 pm, Paul Dupuis via use-livecode > wrote: > > 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) > > Thanks all, > > ___ > 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
Re: Field highlited
Use the effective keyword as in: put the effective hiliteColor of field X into tHiliteColor It will figure out the color by inheritance. If you just put the hiliteColor of field X (without it being set specifically for field X) your get empty On 7/14/2023 12:14 PM, Mark Smith wrote: BTW, is there a way of determining the default highlight colour? When I select some text in a field it highlights to a light blue color, but I can’t find where that color is set. Thanks Mark On 13 Jul 2023, at 11:01 pm, Paul Dupuis via use-livecode wrote: 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) Thanks all, ___ 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
Re: Field highlited
On 7/14/23 11:14 AM, Mark Smith via use-livecode wrote: BTW, is there a way of determining the default highlight colour? The dictionary says: "By default, the global hiliteColor property is set to the system highlight color." I'd guess yours is blue. That's pretty standard on Mac. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ 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
Re: Field highlited
It is really very easy to do this sort of thing: set the hilitecolor of fld "f1" to red Best, Richmond. On 14.07.23 23:39, J. Landman Gay via use-livecode wrote: On 7/14/23 11:14 AM, Mark Smith via use-livecode wrote: BTW, is there a way of determining the default highlight colour? The dictionary says: "By default, the global hiliteColor property is set to the system highlight color." I'd guess yours is blue. That's pretty standard on Mac. ___ 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
Re: Field highlited
The effective attribute is what I was looking for. As Paul mentioned, if you just say “set the background of… to hiliteColor” you don’t get anything. But if you set it to the “effective hiliteColor” you get the system default (btw, I tried “system hiliteColor” but LC treats it as a syntax error. Pity, since “system” in this case makes more sense to me than effective. But that’s another story…) I was intrigued by Pauls example of trying to set some highlighting that “sticks” but that still gives the user the illusion that nothing unusual is going on ie. If you select another portion of text, the first selection unhighlights, of if you click in the field the highlighting goes away, but you can click in other fields and it doesn’t. I saw it as a challenge to try and get that working. He probably has more elegant code than I do but the following comes very close, I hope, to the solution he was describing. The biggest challenge I found is that when you have a selection in the field, and you go to change it to some other text the normal behaviour is to have the first selection immediately disappear. That doesn’t happen if you are depending on a selectionChanged message since you don’t actually get that until the end of the 2nd selection and you need the old one to disappear when you start the 2nd selection. I solved that by having an openField handler that just checks to see if there is a selection, and if there is, removes it. openField happens immediately and before selectionChanged is sent. I can’t remember at the moment why I left the removal in both handlers, but it seems it was necessary for some combination of clicks or selections. I’d have to go back and test that again. on openField -- a selection is potentially about to begin -- see if there is already a selection in the field and unhighlight it put the cpChunkExpression of field "fld1" into chunkExp if chunkExp is not empty then set the backgroundcolor of chunkExp to "" -- gets rid of our fake highlighting set the cpChunkExpression of field "fld1" to empty end if end openField on selectionChanged -- get the current highlight color put the effective hiliteColor of field "fld1" into tHiliteColor -- then initialize our new chunk expression put the selectedChunk of fld "fld1" into newChunkExp -- determine if there is an old chunk we need to unhighlight put the cpChunkExpression of field "fld1" into chunkExp if chunkExp is not empty then set the backgroundcolor of chunkExp to "" -- gets rid of our fake highlighting set the cpChunkExpression of field "fld1" to empty end if -- now, with regards to the new chunk expression there are 3 possibilities -- 1. its empty, in which case we do nothing -- 2. its just an insertion point, in which case we do nothing (ie. word 2 of newChunkExp > word 4) -- 3. But, if word 2 and word 4 of newChunkExp define a range of text, highlight it if word 2 of newChunkExp < word 4 of newChunkExp then set the backgroundcolor of newChunkExp to tHiliteColor -- and save it for future reference set the cpChunkExpression of field "fld1" to newChunkExp end if -- if we want to unhighlight everything we can just click anywhere in the field end selectionChanged > On 14 Jul 2023, at 9:39 pm, J. Landman Gay via use-livecode > wrote: > > On 7/14/23 11:14 AM, Mark Smith via use-livecode wrote: >> BTW, is there a way of determining the default highlight colour? > > The dictionary says: "By default, the global hiliteColor property is set to > the system highlight color." > > I'd guess yours is blue. That's pretty standard on Mac. > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > > > ___ > 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