LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the list box text justification

Hi,

 

Is it possible to the change the text justification in a list box ? to right or center for example ?

 

in the control i can't change it....

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 1 of 6
(3,663 Views)

You can change the text alignment of a listbox both in the UIR editor and programmatically. While editing listbox properties in the UIR editor use Text style... button to display the Edit text attributes dialog box where you can set the desired text alignment. In code, you can use SetCtrlAttribute with ATTR_TEXT_JUSTIFY attribute.

Both methods affect the whole control aspect, i.e. is not possible to have part of text in a textbox left justified and some other text right justified.



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 6
(3,662 Views)

Hi Roberto,

 

I'm attaching a pic.....

 

as you can see I can't select the justefiction it's dimmed.

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 3 of 6
(3,659 Views)

I am sorry: I made a confusion between a listbox and a textbox Smiley Embarassed

 

A listbox is natively left justified and you cannot change this in the UIR editor. You can apply the appropriate justification elements while creating the string to pass to the listbox: see the online help for Item Label parameter in InsertListItem function. All escape codes are to be applied to every line you insert into the listbox: there is no way to apply a default formatting style to the control.



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 4 of 6
(3,650 Views)

Thanks Roberto

 

those are very nice options witch can be very useful ! 🙂 

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 5 of 6
(3,645 Views)

Another possibility is you could try using a table with only one column visible and set the justification of all the cells to VAL_CENTER_RIGHT_JUSTIFIED.

0 Kudos
Message 6 of 6
(3,637 Views)