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.
Solved! Go to Solution.
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:
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).
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
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.
In fact, the dynamically registered Tab Mouse Down Fired again this time. But the order of these two events changed.