LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I display various colored strings in a text box in a single row?

I would like to display various colored data in formatted columns on the CRT. The data is formatted into strings, and I am using the SetCtrlAttribute command to change the color of the string prior to being displayed in a textbox. The problem is that once a SetCtrlAttribute command is encountered by CVI, it apparently, changes the WHOLE box to display text in the selected color. I would like to have a row with 5 columns of data, and based upon some test, determine what color to print the data in the various fields on the same row.
How can this be accomplished? Can this be done?
0 Kudos
Message 1 of 4
(3,525 Views)
We don't support multiple colors of text in a text box. You could use the Table control for this if you are using CVI 5.5. See the cvi\samples\userint\gridview.prj example.

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 2 of 4
(3,525 Views)
You can use the list box instead of the text box. By embedding appropiate control codes inside the string displayed in the list box you can both divide thext in columns and display every single piece of text with different colours both for foreground and for background.
Look at the help for the Item Label field in the InsertListItem function panel to obtain informations on how to divide text in columns and to color text inside the rows.
You can use this method even with older versions ov CVI (at least version 5 and 4).
Hope it helps.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 4
(3,525 Views)
Brilliant! I was looking for exactly the same thing last week.
I Followed up your suggestion, and found the example
'samples\userint\listdelx.prj' contains the info needed.
DerekL
0 Kudos
Message 4 of 4
(3,525 Views)