LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to fire only one "mouse-down" event when a tab control and its numerical control both have "mouse-down" events with different function

Solved!
Go to solution

Hi, all

 

I have a numerical control in a tab control. Both of them have their own "mouse-down" events in a while loop. But when I click the numerical control, instead of firing the numerical control event only, both of these two events fired. 

Maybe I can check if the mouse is in the range of numerial to filter the events, but if the window rescaled, I have to recaculate the range again. 

 

Is there any other way to do it? 

 

I pasted the test code too. 

 

Thanks!

CQ
0 Kudos
Message 1 of 7
(1,231 Views)

Just tested with modified code to check if mouse is inside of numerical control in Tab "mouse-down?" event. It totally filter out both two events! didn't work either.

here is the code:

tab_mousedown.png

CQ
0 Kudos
Message 2 of 7
(1,215 Views)

I chatted with you after the BALUG meeting, now I see what you are talking about.  I had hoped that all filter events would precede the regular mouse events, but it goes filter/normal filter/normal down the line, and as you discovered, the chain goes pane->tab->container->control.

 

In LV12 (which I think you are using) I would try the following. 

 

Make the Tab Mouse Down a user event

Now the Tab event  will fire after the numeric event, but discarding will not work so you need to pass a true boolean into a shift register to alert the tab event case that the click was inside the control.

Inside the Tab event put a case structure and do nothing (or whatever you want) when the boolean is true.  The only trick is to make sure you pass the shift register value through any event cases which may come between the two (not likely to be many), otherwise the use default works.

 

For fun, when you have made these changes, change the control event to the filter version Mouse Down? and click on the increment button.  Modal window pops up and events keep firing on the increment button.  Yuk.  Stick to Mouse Down and it seems fine.

 

(Having trouble attaching VIs, if you are confused I will try zipping.  Hopefully the instructions are clear to you).

0 Kudos
Message 3 of 7
(1,206 Views)

Hi, Darin

 

Thanks for your reply. Yes, I remembered we chatted about this after the BALUG meeting. Following your instruction, I tried to create a userevent, but I don;t know how to link it with the tab mouse down event and kind of stucked there. 

 

Will be very helpful if you can post a sample code here. 

 

best regards and happy weekend

 

CQ

CQ
0 Kudos
Message 4 of 7
(1,177 Views)
Solution
Accepted by topic author CQ_Li
08-27-2015 04:09 PM

Snippets work

 

TabUserEvent.png

 

Side note:  I really dislike Tab controls and very rarely use them.  And the few times I do use them it is for the tabs themselves which I often use to select amongst VIs to place in a subpanel.

Message 5 of 7
(1,167 Views)

Thanks, Darin

 

it works! I also post the whole sample code. 

CQ
0 Kudos
Message 6 of 7
(1,160 Views)

In fact, the dynamically registered Tab Mouse Down Fired again this time. But the order of these two events changed. 

CQ
0 Kudos
Message 7 of 7
(1,119 Views)