10-02-2009 04:26 PM
How to set a fixed color to a disabled button?
I have a boolean button which has 3 status: on, off and disabled. I don't like the 'grayed and disabled' option. I will use red for off, green for on, and white gray (foreground color) for the disabled status. The HTML color code is BDBDBD. I tried to send the hex number 'BDBDBD' to the button property node 'color[4]' but was told that I was wiring to the wrong type of terminal.
Could any one post a sample code of how to construct the structure of 'color[4]' using a RRGGBB number?
Thanks,
Ryan
10-02-2009 04:35 PM
10-02-2009 04:47 PM
Is this what you're looking for??
Cheers,
-Matt from Cyth
p.s. Have a good weekend!!!
10-02-2009 05:07 PM - edited 10-02-2009 05:09 PM
Dennis and Matt,
Thanks. But somehow it does not work.
I am using the button to start and stop a critical task. The task only runs ONCE. After the task finished, I disabled the button and set it to a different color from on or off. The attached figure shows how I change the text, color of the button, and then turn the switch off and disable it. Somehow after finishing the button shows the 'off' status color. I change the order of 'disable' and 'off' but get the same.
In your sample code, can you turn the 'Disable Test Bool' button on and off once and then disable it and set it to the gray color?
Thanks and have a nice weekend,
Ryan
10-02-2009 05:26 PM
Honestly, it looks like a dataflow problem. Change the order in which you Disable, then change the color. Right now you're changing the color while it's in an enabled state, Then you set it to disabled and false.
Try changing it to disabled and false, then change the color. That should straighten out the issue.
I'm not sure what you're using this for, a better description of what you're using this for would help give you the best solution.
Regards,
-Matt
10-03-2009 03:53 AM
The colors of the Colos[4] property expect 4 colors:
I am not sure you are writing all 4 colors.
I don't consider this a issue of date dependency, setting the status to disabled (1) should not change the colors.
Ton
10-05-2009 10:57 AM
Thanks for all your help.
Here is a example code. I tried to change the foreground color of the slide switch. And finally I found the following post:
http://forums.ni.com/ni/board/message?board.id=170&message.id=257168&query.id=575056#M257168
I am using LabVIEW 8.6. Does this question have the same answer?
Thanks,
Ryan
10-07-2009 12:58 AM - edited 10-07-2009 01:01 AM
What exectly do you want and do you see.
If I run the code you have in LabVIEW 9.0, I get the following result after running.
For convenience I have shown the second color array you set as color indicators:
Note that you use grey as the colors for True and False
Here I have set made the colors more distinct:
Ton
10-07-2009 08:21 AM
Ton,
Thanks. It is a good method to debug the button colors. Could you please paste the code?
Anyhow, my question was solved at this post:
http://forums.ni.com/ni/board/message?board.id=170&message.id=445780#M445780
Ryan
10-10-2009 02:50 AM
Hi Ryan,
I used your code, just replaced the constant colors with a control, and replaced the numerics with color pickers.
Ton