LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetCtrlAttribute doesn't update ATTR_LABEL_TEXT

Solved!
Go to solution

I am calling SetCtrlAttribute(handle, ATTR_LABEL_TEXT, graphcontrolID, "arbitrary text"), but the text label on the graph control isn't getting updated.  I tried calling ProcessDrawEvents(), but that doesn't help.  How do I get the label to change?

0 Kudos
Message 1 of 6
(5,389 Views)

the sequence of parameters is wrong in your example, it should read: SetCtrlAttribute ( panel_handle, control_id, ATTR_LABEL_TEXT, "label text" );

0 Kudos
Message 2 of 6
(5,386 Views)

Should be:

 

SetCtrlAttribute (panelHandle, PANEL_CONTROL, ATTR_LABEL_TEXT,  "arbitrary text");

0 Kudos
Message 3 of 6
(5,385 Views)
Solution
Accepted by topic author gstemp

Hi shpanda,

This is the definition of SetCtrlAttribute:

int SetCtrlAttribute (int panelHandle, int controlID, int controlAttribute, ...);

 

for example

SetCtrlAttribute (panelHandle, PANEL_Control, ATTR_LABEL_TEXT, "text");

 

It seems that you have first the controlAttribute than your controlID, try to change the other in this way:

SetCtrlAttribute(panelhandle, PANEL_graphcontrolID, ATTR_LABEL_TEXT, "arbitrary text")

 

Also make sure that the name of handle corresponds to the name of your panel.

Regards,

Jaime Peña
National Instruments Mexico
Ingeniería de Aplicaciones
www.ni.com/soporte
0 Kudos
Message 4 of 6
(5,383 Views)

Oops.  Thank you.  Just a typo.  That was easy!

0 Kudos
Message 5 of 6
(5,377 Views)

SetCtrlAttribute()can't change the control value and display it immediately, when you use the SetCtrlAttribute function, the control will be updated after the dispaly function called, so if you want to chang a control value and display it immediately,you can use the SetCtrVal, this function can implement, but it will take a little long time.

 

GOOD LUCK

0 Kudos
Message 6 of 6
(5,293 Views)