LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is there an inverted event structure?

I have some code I would like to operate like an inverted event structure might work. In other words I want the event structure to operate unless I mouse over the control. Can this be done with an event structure or some other code trick?

 

Tay

0 Kudos
Message 1 of 9
(2,861 Views)

slipstick wrote:

I have some code I would like to operate like an inverted event structure might work. In other words I want the event structure to operate unless I mouse over the control. Can this be done with an event structure or some other code trick?

 

Tay


 

As I understand the Q yes.

 

Use a "Time Out" event do to all of the work you want done when not over the control.

 

Use another event "Mouse Move" for the control of interest that does nothing.

 

Note: Mouse Enter and Mouse Leave may also be of use.

 

Ben

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

Some additional detail

 

Mouse move for a pane returns the pane's coordinates of the mouse.  If the coordinates ore with-in the the control of interests bounds then skip the processing else dont skip the processing.  Mouse ender and mouse leave might be easer.  On mouse enter, unregister for some un-events or set a flag to not process and on mouse leave of the control of interest register for the events or reset a flag to keep processing.

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 9
(2,837 Views)

slipstick wrote:

I have some code I would like to operate like an inverted event structure might work. In other words I want the event structure to operate unless I mouse over the control. Can this be done with an event structure or some other code trick?


 

You already got some good replies, however I don't quite understand what you mean by "operate". Could you be a bit more specific? What kind of control?

 

For example if you have a string control and you don't want the assocated event to fire unless you finish the text entry, use a "value changed" event (instead of e.g. mouse down), set the control to "limit to single line",  and uncheck the "update while typing" option.

 

Along Ben's idea, here's a simple example that "pauses" the VI when the mouse is over a certain indicator. Maybe it can give you some ideas.

 

 

Message Edited by altenbach on 11-25-2008 08:55 AM
Download All
Message 4 of 9
(2,815 Views)
Here's a picture of the code. The while loop iterates always, and I want the loop to stop when the serial number control is being changed, otherwise to continue to loop. Right now it gives me 100 msec to change the value, and I don't want to slow the loop down to several seconds every iteration so the operator can change the value. I should have used a state machine perhaps, but it's too late now.
0 Kudos
Message 5 of 9
(2,794 Views)
It seems impossible to give any advice from looking at a small portion of a diagram image. 😉
0 Kudos
Message 6 of 9
(2,776 Views)

well, here's the code - won't run since there's a lot of external files it references.

 

Tay

 

edit - I have made a change from the image and am using a string input converting to a number - the program sort of stops until I click out of the string box.

Message Edited by slipstick on 11-25-2008 01:19 PM
0 Kudos
Message 7 of 9
(2,766 Views)

I would probably refactor the code quite a bit.

 

I have no time to explore the entire code structure in detail, especially since I don't have access to an 2000x2000 monitor at the moment, but couldn't you replace most of the lower while loop with a simple event structure?

 

Everything would be much easier.

 


Some other random  comments:

  • Many (probably most) of your value property nodes could be eliminated if you would use latch action booleans (e.g. for stop).
  • You'll get more efficient code if you would replace all your remaining value property nodes with local varables.
  •  Some code makes little sense, for example in the following segment you iterate over a 2D array but only retain the result of the last comparison. Seems like a lot of throwaway CPU cycles for nothing. You could index out the last element and get away with a single comparison (no stacked loops!) if that's the functionality you need. (See image).

 

Message Edited by altenbach on 11-25-2008 01:37 PM
0 Kudos
Message 8 of 9
(2,734 Views)

 

 

Yeah I could have used an event structure, but I've had trouble in the past with data getting through some of the cases.

 

When I went to the LabVIEW class here in Colorado, the instructor left me with the impression that local variables are really bad and to avoid them, so I have. He said property nodes aren't much better, but when used only for indicators they are ok.

 

I'll have to look at your comment on latching Booleans. When I have tried to use them the program doesn't allow property nodes with them.

 

And you are right with the nested for loops in the image. I need to have them stop on the first true result or finish all the loops and pass out a false. I guess I'll make them conditional.

 

Thanks!

 

Tay

 

0 Kudos
Message 9 of 9
(2,721 Views)