From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

enable, disable and re-enable an event

Solved!
Go to solution

Good evening, I have a question:


You can enable, disable and re-enable an event in an event structure in Labview ?, I managed to turn it off but I do not know how to re activate it in the same run, I thank you a sample program that can guide me,

 

Thanks.

0 Kudos
Message 1 of 16
(4,934 Views)

Maybe this example not very simple.
You can register event with empty constants. In this case event never become.

event.png

0 Kudos
Message 2 of 16
(4,898 Views)

Why not make it simpler?  Create the event.  Create a flag (global/fgv/whatever).  Put a case structure in the event structure.  Use the flag to make it run when you want it.  Otherwise, the event triggers but does nothing.

0 Kudos
Message 3 of 16
(4,877 Views)

Of course case possible, but it have two minuses:
1) you need frame in frame.
2) event may has big data, so it memory leak.

But this variant real simpler.

0 Kudos
Message 4 of 16
(4,865 Views)

1) You have a frame in frame using your solution. 

2) You're also using an event.  If there's a memory leak, it's due to your poor programming and not the event structure.  You'd want to take a look at resolving THAT problem.

 

The problems you cite both exist in your implementation.  You've just added complexity to something needlessly.  You don't address either with your design.

0 Kudos
Message 5 of 16
(4,854 Views)

I agree with natasftw, one of the most common use for event structure is in the producer/consumer architecture. When the flag is on you enqueue the command and when off you don't, simple as that in this case.

 

Ben64

0 Kudos
Message 6 of 16
(4,845 Views)

natasftw wrote:  2) You're also using an event.  If there's a memory leak, it's due to your poor programming and not the event structure.  You'd want to take a look at resolving THAT problem.

Actually, not being registered for the event fixes this issue.  If the event has a lot of data in it, each event structure that is registered for it has a copy of the data.  By unregistering for the event, you are eliminating a copy of the data.  With using the flag, you still have that copy happening.

 

Personally, I do not see one any more complicated than the other.  But I would say the unregistering for the event is the more efficient one.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 16
(4,835 Views)

1)I have frame only in one frame (on/off).
If you will check in all events you will check many cases.

2) If you generate big data (array 10000 points), this memory frame will allocated and deallocated.

And your variant generate unnecessary events.
This simpler but not always better.

For controls on FP much better use enable/disable property

events.png

0 Kudos
Message 8 of 16
(4,833 Views)

1. Ok, Sorry but I don't understand "the flags", anyone has an example or where can I learn about it?.

 

2. Thanks for your answers, but I don't know which of the proposed solutions is best for my application: I need to move through the rows of the multicolumn box, and pressing "ENT" listbox appears, and pressing "DOWN" selection moves in the listbox, NOT in the multicolumn box, for this I need to disable the event "Ok Button 2 : Value Change "... I attached the vi to you understand me better.

 

Pd: Sorry for my bad english, I speak snpanish.

0 Kudos
Message 9 of 16
(4,804 Views)

 

Artem.SPB please, can you change the version of LabVIEW to 2014? I can't see the vi, Thanks..

0 Kudos
Message 10 of 16
(4,800 Views)