LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

text boxes formatting question

Is there an elegant way to format strings in a text box such that each line of variable length that is inserted has a PASS or FAIL message lined up under each subsequent inserted line similar to having a vertical line in a List Box? I have an automated test for a functional PCB test that inserts a line of text indicating the start of the test and at the end of the test, it replaces the line based on a Pass or Fail result with the result placed towards the right hand side of the text box after the end of the main line of text. With each inserted line, the Pass/Fail result should line up vertically. It is very difficult to accomplish this even when placing spaces between the end of the text and the Pass/Fail result. The difficulty is that the text box is graduated in pixels, not text characters, so it is difficult to get the result text to line up perfectly under each other similar to a list box vertical line separtating the two areas. I would use a list box, but it will be difficult to replace all of the places that I am using text box line insertions. I may end up doing this, but it would be nice to know if someone has accomplished this already.
 
Thx for any help!
0 Kudos
Message 1 of 7
(3,960 Views)

Vertical alignment in a text box can be a pain if you are using a proportional font but it becomes easier if you switch it to a fixed font since all the matter reduces to adding a correct number of spaces between strings.

But since you need to modify all of your software to accomodate the strings, I would consider moving to a listbox that is more elegant: better alignment and the possibility to green/red coloured text to make test resukts more evident.



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?
0 Kudos
Message 2 of 7
(3,952 Views)
Sorry about this question, but what is your suggestion as to a good font to use that is not proportional?
 
Thx!
0 Kudos
Message 3 of 7
(3,932 Views)
Well, CVI comes with NIEditor font which is not proportional; on your system you may have other non proportional fonts (like Courier for example). You may need to dig into the font folder in your system and experiment with the fonts installed: consider that TrueType and openType fonts are always proportional, so your choices reduce a lot Smiley Surprised


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?
0 Kudos
Message 4 of 7
(3,930 Views)

I don't think that it is the case that all TrueType fonts are proportional, although most are. My short list would be Courier New, Lucida Console, and (if you have Office 2007) Consolas. These are all TrueType fonts.

Beware of missing fonts on target machines if you distribute your app. You can include them in the distribution kit, if needed, and if copyright allows.

Though I have not checked it, the CVI IDE seems to list only proportional fonts (some TrueType, some not) as editor options; maybe that will help you find one to use. See attached screenshot. Note that NIEditor on most machines will map to "Courier" (a non-TrueType font).

--Ian

0 Kudos
Message 5 of 7
(3,920 Views)
Why not uing table to display the information?
 
0 Kudos
Message 6 of 7
(3,878 Views)
Thanks all for your help and tips! I decided to change the textbox to a listbox to utilize the benefits of the formatting, the alignments and the colors, now its working just fine!
0 Kudos
Message 7 of 7
(3,863 Views)