01-02-2018 02:32 PM
When using a property node to style text in a string, I found that the style will be applied to the entire string whenever Selection.Start = Selection.End.
Is this expected behavior?
I expect no style to be applied if there is no text selected. When selection start=selection end, this is equivalent to having a cursor placed between two characters in the string. When applying styles manually under this circumstance, no style will be applied to any character.
See attached example. LV2014
01-02-2018 02:51 PM
I would guess that this is the expected behavior. Otherwise you would have to always set the selection positions in order to change the style. Therefore the default behavior assumes to set the style for the entire string when start equals end. You can try an experiment and see if the style is changed if you force end to be less than start.
01-02-2018 02:59 PM
Help says
"
Text selection specified in terms of character positions for the beginning of selection (inclusive) and end of selection (not inclusive). If you set the start and end to be the same, LabVIEW inserts a caret into the text.
"
When testing I do NOT see the caret.
Ben
01-02-2018 03:58 PM
Hi Mark, good point. If end is less than start,t eh entire string is changed. Again, not expected, as I don't see why end can't be less than start. Here I've set a range specifically and gotten an unexpected result, but it is easy to work around. Just one of those gotchas, I guess.
01-02-2018 04:00 PM
Not sure what is meant by a carat (probably "^"). but then that would be a really weird behavior, so I'm glad the help is wrong. What maybe should happen is that LabVIEW would insert a cursor. This is of course quite reasonable, though I believe actually selecting text is a different node than what I'm trying to do here.