LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Library function error (return value == -46 [0xffffffd2]). The attribute passed is not valid , -> Button Backround Colour cannot be changed

I got this errormessage while executing  my application ,

Code :

SetCtrlAttribute (PanelHandle_2, PANEL_2_COMMANDBUTTON_3, ATTR_LABEL_BGCOLOR, VAL_DK_RED);

I took the attibute value out of the offered list .

Any ideas why my smart button may not become red?

Thank you

Beethoven


0 Kudos
Message 1 of 7
(4,564 Views)
This is probably because the panel containing your button is set to be conform to the system colors. You can solve this by disabling this attribute:
 
SetPanelAttribute (pnlHandle, ATTR_CONFORM_TO_SYSTEM, 0);
 
If you are using CVI8.1, it might also be that the panel (and thus also the button) are automatically adjusted to the Windows System Theme. So you should also solve this:
 
SetCtrlAttribute (pnlHandle, PNL_BUTTON,  ATTR_DISABLE_PANEL_THEME, 1);
 
 
0 Kudos
Message 2 of 7
(4,563 Views)
Thanks a lot for the quick response.
I implemented  the first hint , but the result was the same error message as before.

When trying to implement  the second hint , I got an error box when inserting the function panel text , because
ATTR_DISABLE_PANEL_THEME   is not known in CVI 8.0.1.

For the moment I can only change the LabelText Coulour, what should be sufficient for my application .


0 Kudos
Message 3 of 7
(4,554 Views)
The attribute you listed in your code was for the label; perhaps you meant to use the one for the command button itself?

    SetCtrlAttribute (PanelHandle_2, PANEL_2_COMMANDBUTTON_3, ATTR_CMD_BUTTON_COLOR, VAL_DK_RED);

JR
Message 4 of 7
(4,552 Views)
Hello JR ,

your solution was great. I checked the  code  and found exactly that mistake.


Thanks a lot and greetings to wherever you are.

Beethoven
0 Kudos
Message 5 of 7
(4,546 Views)

Hi, there is my question: Library function error (return value == -46 [0xffffffd2]). The attribute passed is not valid

 and the code :   SetCtrlAttribute(ciCVIPanel, ciCVIControl, ATTR_TEXT_POINT_SIZE, 10);

 

 

would you please help me check it? i have no idea about this issue.

0 Kudos
Message 6 of 7
(3,610 Views)

The error says all: you are addressing an attribute which cannot be operated on the control type you are using. It all depends on which control is pointed to by ciCVIControl variable.

A good option to know the attributes that can be use on a single control is to right-click on the control and select Control help: in the window that shows, select Control Attributes link and you will see a list of all valid attributes for that control type.

Alternatively, right-click on SetCtrlAttribute instruction and execute Recall function panel function (or press Ctrl+P) and click on Control attribute field: Select Attribute Constant dialogue will show where you can select the control type you want to operate on in the list on the left: in the right pane valid attributes only will be shown.

 

 

As a last note, it would be better in the future to open a new discussion instead of reviving a very old thread with a question that is only marginally related to it.



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 7 of 7
(3,606 Views)