LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Text box control with syntax styling

I want to have a control that shows syntax styling. The user will be entering XML; I want it to show up stylized so that text nodes show up looking different than tags which look different than attributes. I found a random example on the web:

Any ideas?

CLED (2016)
0 Kudos
Message 1 of 5
(3,154 Views)

It sounds like what you are looking for would be to either create an xControl or find something already built (likely in another language).  The xControl is simply a control that has code running in the background (where the code would be looking for open and closing brackets for highlighting or indentation levels).  Here is a tutorial if you have to resort to building this yourself.

 

Otherwise, you could look for an XML Editor that has an ActiveX interface that you could plug directly into LabVIEW.  I personally would go with this approach if it's available, but a quick google of the webs didn't show anything immeadiately promising.  If you find something, would you mind posting it back up as I could find uses for a tool like this myself.

B Sampson
Ceres Bio Fuels
0 Kudos
Message 2 of 5
(3,136 Views)

With an xcontrol you would be formatting the text with property nodes right? That's a bit slow right? As a test I went through every line of a 2K document and changed to color of each line. It took my computer ~250 ms to do that. Seems slow. Maybe I need to generate an array of format for each char and do a diff to see what things changed so I can just change the format on the characters that need to change? Is there any way to make the property nodes operate a bit faster? Maybe a rich text box is the way to go.

 

Also, not sure if this is possible but it would be nice to have line numbers. That is, an indicator on the left showing what line the user is editing.

CLED (2016)
0 Kudos
Message 3 of 5
(3,084 Views)

Did you turn off FP updates when you were running your test? You may see better performance if you disable FP updates, run your formatting code and then enable the FP updates.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 5
(3,080 Views)

@Mark_Yedinak wrote:

Did you turn off FP updates when you were running your test? You may see better performance if you disable FP updates, run your formatting code and then enable the FP updates.


Thanks for the tip. Now it takes ~20 ms.

CLED (2016)
0 Kudos
Message 5 of 5
(3,068 Views)