LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable indicator that triggers an event case

Hello,

 

I'm using Labview version 8.2. In my Labview program pushing the button of one of the indicators triggers an event case without changing the appearance of the button. Therefore changing the indicators to a control isn't an option. I wanted to disable a few functions (event cases triggered by indicators) in my labview program without changing the code in the block diagram. I disabled some of the indicators by changing them to disabled (or disabled and greyed) in the properties window. However the program still triggers the event case when the disabled button (indicator) is pressed. Is this some kind of bug or did I do something wrong? Is there a simple solution to disable indicators that trigger an event case without changing the block diagram?

 

Thanks in advance

Thomas

0 Kudos
Message 1 of 5
(3,533 Views)

You will need to use Dynamic Events. Have a look at the following forum thread:

Enable and disable events programatically

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 2 of 5
(3,528 Views)

Adding to Adnan's reply...

 

You did not tell us what type of event but I will guess that it is "mouse down" or similar. Disabling a control does not disable the events unless you implement dynamic event registration (or extra code to check the diable state before taking action). This is not a bug and is useful where you want to know if a user clicked on a diasbled control. An example: You want implement security on some controls by disabling them. If a user that is not logged in click on a control that is disabled, your code can pop-up a message saying "Please log in before attempting to use this button."

 

Take a look at this Nugget by Ton where he taught us how to use dynamic events.

 

Have fun!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 5
(3,516 Views)

Yes you're right Ben. The event case is mouse up.

 

Thanks for the help I'll take a look at the exampel.

0 Kudos
Message 4 of 5
(3,502 Views)

tiekai wrote:

I'm using Labview version 8.2. In my Labview program pushing the button of one of the indicators triggers an event case without changing the appearance of the button. Therefore changing the indicators to a control isn't an option. I wanted to disable a few functions (event cases triggered by indicators) in my labview program without changing the code in the block diagram. I disabled some of the indicators by changing them to disabled (or disabled and greyed) in the properties window. However the program still triggers the event case when the disabled button (indicator) is pressed. Is this some kind of bug or did I do something wrong? Is there a simple solution to disable indicators that trigger an event case without changing the block diagram?


You already received good answers, but here are a few more comments.

 

(1) If all your worries are about the change of apperance during activation, you can customize the button so TRUE and FALSE look indentical. Now change it to a control, and use "value changed" event. Now disabled will no longer trigger the event.

 

(2) It is often a bad idea to use indicators as controls because it blurs the distinction and makes for confusing code (and often forces the use of local variables). Sometimes it is OK, though. 😉

 

(3) If you really want to use "mouse up" on an indicator, you could just use a case structure and do nothing if it is disabled, e.g. as follows:

 

Message Edited by altenbach on 01-07-2009 08:29 AM
Message 5 of 5
(3,490 Views)