LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

label position using NewCtrl()

I created a command button using NewCtrl() and it put the label up and to the left of the ctrl instead of inside it. I didn't even know that you could move a command button label outside the button's boundaries. But I want it centered in the button, like usual. Is there an easy way to do this?
0 Kudos
Message 1 of 2
(3,022 Views)
A simple command button should have its label centered inside it, unless you created a text button (found in UIR editor in the 'Toggle button' menu.

As we read in the help for the 'Control attribute' field in SetCtrlAttribute ():

Constant: ATTR_LABEL_TOP
Data Type: int
Description: The vertical offset in pixels of the label relative to the origin of the panel.
The panel origin (0,0) is the upper-left corner of the panel below the title bar and to the right of the panel frame.

Control Types: All except Text Message, Command Button, Decoration
Values:
VAL_AUTO_CENTER



To center the label in the control, you can use the VAL_AUTO_CENTER constant both for top and left attribute for the control's label.

I attach a simp
le source demo file: use it as the only file for a new project and run it.

Hope this 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?
0 Kudos
Message 2 of 2
(3,022 Views)