Michael Aivaliotis Posted July 1, 2004 Report Share Posted July 1, 2004 Here is an example VI (LV7.0) that shows how to manipulate text in a text box. The focus of this example is the Selection Start + Selection End property. This can be very powerful in performing custom live formatting of front panel text. The trick here is to perform formatting on the text after you highlite the section of interest. The Font property is then used within the same property node. text_hi_lite.vi - Image: Download File:post-19-1088657566.vi Quote Link to comment
donroth Posted July 12, 2004 Report Share Posted July 12, 2004 [attachmentid=undefined]Wouldn't you want to do this more efficiently with event structure? .... Don Here is an example VI (LV7.0) that shows how to manipulate text in a text box. The focus of this example is the Selection Start + Selection End property. This can be very powerful in performing custom live formatting of front panel text.The trick here is to perform formatting on the text after you highlite the section of interest. The Font property is then used within the same property node. 1084[/snapback] Download File:post-115-1089650321.vi Quote Link to comment
Michael Aivaliotis Posted July 12, 2004 Author Report Share Posted July 12, 2004 Wouldn't you want to do this more efficiently with event structure? .... Don 1131[/snapback] Yes! Thank You Don for the updated version. My goal was to show how the specific property node would be used. The event structure as you show it would be a much better, and preferred, implementation. Thanks for the improvement. :thumbup: Quote Link to comment
aledain Posted July 13, 2004 Report Share Posted July 13, 2004 Don't know how the event structure improves the following because I don't have access to >6.1 at the moment ... When I originally was after this sort of thing I was using it to create a ?simple? text editor and the highlighting was for the FIND method. It works nicely (apart from a brief flash as the text is highlighted). Now is it possible to extend this to give me real time <cough> syntax highlighting? By that I mean as I type 'word' and word is in my list of defined text strings to be green, it gets coloured green. I reckon this could be done with the text select and highlight method outlined before, but it might be pretty ugly (flash, flash, etc), especially when loading and parsing a file for syntax highlighting at startup. Does anyone have any better ideas? Quote Link to comment
Michael Aivaliotis Posted July 23, 2004 Author Report Share Posted July 23, 2004 Don't know how the event structure improves the following because I don't have access to >6.1 at the moment ...LV6.1 has event structures. Now is it possible to extend this to give me real time <cough> syntax highlighting?I don't see why not? Have you tried it? What problems are you seeing? I reckon this could be done with the text select and highlight method outlined before, but it might be pretty ugly (flash, flash, etc).I didn't see any flashing on my end in the examples posted previously. I saved the LV7.0 version into 6.1 however I noticed that the behavior changed. The 6.1 version behaves very buggy. It does not remove the hi-lighting... Open the attached VI using LV6.1 to see bug. Download File:post-2-1090558621.vi Quote Link to comment
jpdrolet Posted July 29, 2004 Report Share Posted July 29, 2004 In a recent Info-LabVIEW thread there was a need for HTML display. I have wired this SimpleFormatter.vi that accepts tagged (markup text) and display it in a string. With a syntax parser that will wrap keywords with property tags, it can be used for syntax highlight. It still require some work (to handle the character "<") and has merely been tested with the provided example. The font property also needs to be implemented. Correct syntax is assumed. I defer panel updates when formatting the string but the string indicator is still drawn twice. Download File:post-447-1091080666.vi Download File:post-447-1091080685.vi Quote Link to comment
didierj Posted July 30, 2004 Report Share Posted July 30, 2004 I saved the LV7.0 version into 6.1 however I noticed that the behavior changed. The 6.1 version behaves very buggy. It does not remove the hi-lighting... Indeed, the behaviour in LV6.1 is strange, but there is a workaround to revert a formatting of a portion of the text: 1. select the whole text in your control/indicator 2. format it the way your text portion was formatet (e.g. make whole text bold) 3. revert the formatting on the whole text (e.g. bold set to false) 4. reformat the portions that should have kept their format. Didier Quote Link to comment
didierj Posted July 30, 2004 Report Share Posted July 30, 2004 It's again me... I made some tests and got (hope so) the problem on LV6.1 with undoing a text format. It seems that the SelStart and SelEnd marker have to reside on a text that is formated the way you want to undo. In between have as much different formatings as you want. E.g. if you want to undo bold on a text portion, the character after SelStart and the one before SelEnd have to be bold. The other way nothing happens. I've rewritten Michael's example with an event structure. It gives back the new value of the slider (to format the new portion) and the old value (to unformat). Didier Download File:post-253-1091175663.vi Quote Link to comment
The A-Man Posted July 30, 2004 Report Share Posted July 30, 2004 Excellent! I fiddled with this for an hour on Wednesday and could not figure out the odd behavior in LV 6.1. Your solution is great, it solves the problem exactly. Thanks, Quote Link to comment
gleichman Posted September 9, 2004 Report Share Posted September 9, 2004 I downloaded SimpleFormatter.vi and after using it, I found a small bug. All text after the last text formatter is truncated. I also modified the search for tags to be case independent, so now <b> = <B>. This new version is in LabVIEW 7.1. Thanks for this cool new tool jpdrolet. In a recent Info-LabVIEW thread there was a need for HTML display.I have wired this SimpleFormatter.vi that accepts tagged (markup text) and display it in a string. With a syntax parser that will wrap keywords with property tags, it can be used for syntax highlight. It still require some work (to handle the character "<") and has merely been tested with the provided example. The font property also needs to be implemented. Correct syntax is assumed. I defer panel updates when formatting the string but the string indicator is still drawn twice. 1250[/snapback] Download File:post-151-1094751483.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.