LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

making a button programmatically not change its 'physical' state when pressed

I have this button:

button1.jpg

which changes into this when pressed:

button2.jpg

How do i programmatically make the button not change into its 2nd state when pressed? do i use property nodes? if so, how?

 

thanks

 

0 Kudos
Message 1 of 7
(3,497 Views)

All you have to do is change the red color to be green as well, and the button will not appear to change states.

0 Kudos
Message 2 of 7
(3,480 Views)

thanks for your reply, unfortunately there are other parts of my program that use that button where I need to keep the switching.

 

having said that, is it possible to programmatically not change the buttons 'physical' state when pressed?

 

thanks

0 Kudos
Message 3 of 7
(3,473 Views)

If you use the Colors Property Node, you can change the colors dynamically, so you can set it all green when you need it, then change it back to green and red.

 

The only way you can intercept the button press is to use the Mouse Down? event in the event structure.  You will need to verify a left mouse click and then Discard the event.  That will be your inidcation the button has been pressed.  However, you will still need to track your state to not discard the event in the situations where you want the button to actuate.

 

It is much easier to dynamically change the colors.

0 Kudos
Message 4 of 7
(3,471 Views)
It sounds like you are trying to programmatically disable the button, and there is a property called Disable to do this. I find that disabled controls (not grayed out), or controls that give no indication when clicked to be a little annoying.
0 Kudos
Message 5 of 7
(3,465 Views)

If you don't want the button to activate (i.e. you won't know that someone tried to press it, what Darin stated is the way to go.  You either disable it (I prefer to grey it out as well) with the Disabled property or you can hide it with the Visible porperty.  I understood that you still needed to know the operator pressed the button.  If that is the case, then neither of these will work, as the button is not pressable.

0 Kudos
Message 6 of 7
(3,449 Views)
You can still respond to Mouse Down? Events on a Disabled control. If it were me, I would hide the label/caption so only the business end of the button is clickable. For example I once showed out to have an Enabled and Grayed Out control.

http://forums.ni.com/t5/LabVIEW/Graying-Out-a-Control-without-Disabling/m-p/1164783#M508780
0 Kudos
Message 7 of 7
(3,438 Views)