LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Multicolumn Listbox" and "Event structure" problem

Hi,

I have a problem with the "Get Clicked Col Hdr" method of a Multicolumn Listbox and the "Mouse Down" event of an Event Structure.
I want my program to run as fast as possible so I placed the method in the mouse down event (because property/invoke nodes are "very slow"). See attached file!

Now the problem is:
When I click on a row I get a value of -2, that's OK!
When I click on a scrollbar I get -2, that's also OK!
But when I click on a Column Header I get also -2. Not OK! But the funny thing is when I click on a Header and then on the scrollbar I get the value of the Header!!!??? When I click on a Header and then a Row I get, as expected, a value of -2.

What's going wrong? Is this normal?

BJ
K
0 Kudos
Message 1 of 5
(3,276 Views)
Use Mouse Up event instead of Mouse Down. Don't ask me why Mouse Up works and Mouse Down don't. My guess would be a race condition between the method and the event. Actually, Mouse Up is preferred in some cases so that a user can change his mind after he clicks Mouse Down. The user can simply move the mouse off of the control before he releases the mouse button.
- tbob

Inventor of the WORM Global
Message 2 of 5
(3,276 Views)
Hi Tbob,

Thank you for your answer. It works fine now!

I didn't try the Mouse Up before and I think this happens using the Mouse Down event:
the event executes immediately when you click on the Listbox and still holding down the mouse button. And I think the method will have a new value after the mouse button is released (seems logic to me!). This doesn't work together!
But I still can't explain the strange behaviour mentioned in my question. Maybe NI or someone else can explain.

But anyway, thanks again!!!
0 Kudos
Message 3 of 5
(3,276 Views)
Hello,

I will try to reproduce this problem and if I can I will post it to our R&D department to have a look at it.

Best regards,

RikP
Application Engineering
National Instruments
Rik Prins, CLA, CLED
Software Development Engineer
0 Kudos
Message 4 of 5
(3,276 Views)
I can reproduce it in LV7.1. It's definitely some sort of race condition: If I enable execution highlighting, it works correctly even with the "mouse down" event.

Preferably, it would be more desirable to have a specific event for this operation (e.g. "header click") and then have the clicked column number available directly from an event terminal.
0 Kudos
Message 5 of 5
(3,276 Views)