LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight text in string control.

I am writing Vi which allows to type some kind of scripts (using string control), highlighting the key words and some expressions. I am parsing the string and using "Selection Start", "Selection End" and "Text Colour" colouring the text. It works but not really good. I continuously reselecting text in order to colour it, so it is flickering a lot, changing position of the cursor and if string is to long it works quite slow.

Can anyone suggest how I can implement syntaxes highlighting (which control to use, maybe different logic etc)?

Any ideas will be very useful.

Thanks
0 Kudos
Message 1 of 2
(2,947 Views)
Here are a couple of suggestions:
1. Don't use the string control. Use an ActiveX control instead, where you can select and color multiple part of the string. A quick test using MS RichTextBox shows that this can be done. It's less easier to control than a LV control, but you're using property nodes anyway. Also, it's windows only.
2. Use the picture control. This will take some more logic, as you will need to remember where you're drawing and what you already drew so that you don't overwrite, but you should be able to handle it.
You can catch the clicks using an event structure (Key Down event).

___________________
Try to take over the world!
Message 2 of 2
(2,930 Views)