LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure Questions

Is there any other benifits to keeping the control insid ethe event OTHER than being able to double click the control on the front panel to gain instant access to teh event that hold the code for the control event.

 

What is the best way / type of event for buttons that are latched until released?

I have had issues in the past with using "value change" type events that results in the operation being ran twice.  Once when the button is pressed and once when the button is released.  Does placing the control inside the event stop this?

 

To prevent the dual code scenerio I have switched to "mouse down" events but have had times when the code was ran even when the control was disabled, but because a mouse click was detected it still ran the code.  To prenet this I have added a property node value check case inside the event to ensure the code is ran only when the value of the control is in the correct state.

 

How are these problems avoided with events?

 

Thanks

Tim C.

1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 1 of 4
(2,567 Views)

Latching boolean controls must be read out in order to latch. If you don't read them they will remain pressed and releasing the control manually will trigger another value change event (as you have noticed). To latch the control, simply place it in the corresponding value change event.

 

For non-latching controls it doesn't make a difference where you put them (as far as I know).

 

Hope this helps

Daniel

 

0 Kudos
Message 2 of 4
(2,564 Views)

dan_u,

 

that's not correct, as any other control might be read before a value change event fires (placed on the left hand side of the event strucutre), thus processing the event with the Old data.

 

Felix 

0 Kudos
Message 3 of 4
(2,552 Views)

@Felix: Of course, data-flow-wise (and thus value-wise) it can make a difference. I just meant it doesn't make a difference in terms of latching/switching behavior. There's no need to place e.g. a numeric control in the event loop from that perspective.

 

Daniel

 

0 Kudos
Message 4 of 4
(2,549 Views)