LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[LV2013] Events ordering (mouse down vs. value changed) ?

Solved!
Go to solution
Solution
Accepted by topic author Kochise

What happens if you set the tree control to fire on mouse up rather than mouse down?  Maybe the mouse down of the tree will cause the string control to lose focus and update, thus signaling the value change event.  And then the mouse up event fires for the tree control. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 11 of 22
(2,010 Views)

As a side note, firing on mouse down is not your typical Windows behavior and may be frustrating to the users of your app.  For instance in the Outlook folder tree, nothing happens on mouse down (at least nothing happens that is visible to the user).  Just a thought.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 12 of 22
(2,007 Views)

The Consumer/Producer example might be the way to go to get the functionality that he wants. That way, he'll be able to control the order of execution. Use a string/variant for the message ID/data.

0 Kudos
Message 13 of 22
(1,993 Views)

That's it, obviously. Value changed event is fired first, *THEN* Mouse released event comes second.

 

Easy as pie, for once.

 

easy-as-pie.jpg

 

David Koch

0 Kudos
Message 14 of 22
(1,945 Views)

See?

 

Its all perfectly logical.

 

No nasty nasty in sight.

Message 15 of 22
(1,923 Views)

Is there a chart somewhere that describes

the order in which the events are processed ?

 

David Koch

0 Kudos
Message 16 of 22
(1,873 Views)

Not that I'm aware of.  This IS a  good suggestion though, currently things liek this belong to the "dark arts" which one simply has to learn (normally the hard way) when programming LabVIEW.  Certain aspects of it are quite logical, but I could certainly get behind a resource which details the actual order of event firing for those who have not yet made their own exploration into the subject matter.

0 Kudos
Message 17 of 22
(1,861 Views)

OK, found a bug with the 'Mouse release' event methodology :

 

If I select 'KOCH David' and want to change the 'truc' in 'Description'

(same level on screen) by click at the right of the text, draging on the

left to select it, if I release the mouse button over the tree, it select the

item underneath the mouse pointer, even though I started pressing

the mouse button in another control. It would be cool to filter the

'Mouse release' event ONLY if the mouse was pressed first within

the control 😕

 

David Koch

0 Kudos
Message 18 of 22
(1,826 Views)

Yes this is indeed a right royal PITA.  Having to manually monitor "Mouse Leave" AND "Mouse up" is a pain.

 

I have wished LV would do this better for YEARS.

0 Kudos
Message 19 of 22
(1,798 Views)

I have even created a process in the past which receives a control reference upon a mouse down, starts monitoring the mouse via "Acquire Input" functionality (independent of LV windows) and then returns the reference via User Event (the reference of the control the mouse down originated from) in order to be able to catch these events.  I then use this user event instead of LV's own "mouse up" event which, as you have discovered, loses interest in what it is you are trying to accomplish rather quickly.

 

It's not 100% becuase the mouse state is polled, but most USB connectors won't update faster than 5ms anyway.

 

It's a pain that we have to code something like this to keep track of this kind of thing.

0 Kudos
Message 20 of 22
(1,790 Views)