LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do set vertical center justify text in a String Indicator?

Does this just pass through to an API call of DrawText? (In which case it must be single line...)
0 Kudos
Message 1 of 3
(4,411 Views)
You cannot do it with LV built in technics. Maybe you will find help by OpenG or in the G toolbox.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 2 of 3
(4,411 Views)
A 'pure LabVIEW' work around for this is (its not completely trivial):

First you need two string indicators. 'String1' is the 'background'. Size it and place it where you want to display the vetrically aligned string. 'String2' the indicator that will actually display the string. Set it up so that it has properly colored text and a transparent background (the 'Simple String' from the Classic Controls palette is good for this).

Second, take the text you want to display and run it through "Get Text Rect.vi" in the Graphics & Sound -> Picture Functions. This VI will tell you how big of a rectangle you need to display the given text (note: you have to manage all the line breaks yourself).

Third, Get the size of 'String1' with its 'Position' and 'Bounds' prop
erties and do the math (top = height/2, etc, etc) on the rectangle from "Get Text Rect" and then position the 'String2' indicator over the top of 'String1' with its property nodes ('Position' and 'Text Size' are the two properties you will need -- 'Bounds' is read only).

Good luck.
Message 3 of 3
(4,411 Views)