11-25-2008 09:07 AM
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
11-25-2008 09:13 AM
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
11-25-2008 09:49 AM
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.
11-25-2008 10:54 AM - edited 11-25-2008 10:55 AM
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.
11-25-2008 11:52 AM
11-25-2008 01:03 PM
11-25-2008 01:17 PM - edited 11-25-2008 01:19 PM
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.
11-25-2008 03:37 PM - edited 11-25-2008 03:37 PM
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:
11-25-2008 04:01 PM
altenbach,
I'll be redoing the code some as there is way too much space in it.
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