LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Vertical alignment for label text

Is there a way to force vertical alignment for text of control labels?

This option is useful when "Size to text" is disabled (so a fixed size is specified), and the text can be on 1 or 2 rows. If there is only one row, it's quite common to see the text vertically centered.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 8
(5,922 Views)

Hi Vix,

 

I am not aware of an attribute that does it - but it's pretty straightforward to implement it yourself using SetCtrlAttribute (,, ATTR_LABEL_TOP,); for example, label height changes from 15 to 28 pt if a second line is added - am I correct that you're going to suggest it ? If so the new attribute could be extended to top_align, center_align, and also bottom_align Smiley Wink

0 Kudos
Message 2 of 8
(5,921 Views)

The label text is loaded from a text file, so I don't know if it needs one or two lines.. for this reason I chose a fixed size; and the text is automatically split into two lines (if necessary).

 

And you're right: I'm going to write a new suggestion Smiley Wink

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 8
(5,916 Views)

...but you could find out using ATTR_LABEL_WIDTH: display the text on an invisible label and measure its width, then compare it to the space reserved for the label...  

0 Kudos
Message 4 of 8
(5,914 Views)

Is this what you're looking for?

 

SetCtrlAttribute (panel, control, ATTR_LABEL_ANGLE, 900)

 

This rotates the label text 90 degrees.

0 Kudos
Message 5 of 8
(5,908 Views)

Hi jared,

I'm not looking for a way to rotate the text 90 degrees.

I'm looking for a way to specify a vertical justification for the text inside a fixed size label area (i.e. if the label text is 14 px high, and the label area is 30 pixel high, I'm looking for a way to leave 8 px above the text and 8 px under the text).

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 6 of 8
(5,892 Views)

Unfortunately, vertical justification is only available for tree and table cells. You could use a single-cell table and make it look almost like a control label, however the edges won't look the same. I don't know how much of a problem that is for you.

 

justification.png

0 Kudos
Message 7 of 8
(5,870 Views)

Waiting for this property in a future release, the best solution is to pragmatically move the label (as Wolfgang suggested)

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 8 of 8
(5,857 Views)