08-07-2015 12:17 PM
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.
08-07-2015 12:21 PM
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.
08-07-2015 12:34 PM
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.
08-10-2015 02:02 AM - edited 08-10-2015 02:10 AM
That's it, obviously. Value changed event is fired first, *THEN* Mouse released event comes second.
Easy as pie, for once.
David Koch
08-10-2015 03:18 AM
See?
Its all perfectly logical.
No nasty nasty in sight.
08-11-2015 01:40 AM
Is there a chart somewhere that describes
the order in which the events are processed ?
David Koch
08-11-2015 02:31 AM
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.
08-11-2015 08:08 AM
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
08-11-2015 10:35 AM
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.
08-11-2015 10:43 AM
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.