LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a boolean control to NOT queue up button click when it is invisible/disabled

I found that my GUI control behaves as expected when runnnig in the development enviroment:  I click it, and while the resulting action is taking place, I disable the button, and clicking on the button has no effect.

 

But, when I build the executable program, clicking the disabled button queues up the click and immediately runs the action again when the previous one finishes.  I've tried making the button invisible AND moving the position, but to no effect.

 

Any ideas?

0 Kudos
Message 1 of 13
(2,967 Views)

Could you post your code? That would help.

 

If I were to venture a guess I would say that you are experiencing some type of race condition that is encountered in the built executable due to changes in execution timing.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 13
(2,964 Views)

Mark,

 

I can't attach my actual code since it has a bunch of proprietary stuff in it, but I have created a real simple VI that demonstrates the issue, BOTH

in pre-compiled and executable form.

 

Run it, and click the start button.  I immediately disable and make invisible the start button.  I then wait 5 seconds, and then re-enable and re-visible the button, and waits for 100ms before going back

to the beggining of the loop to wait for the next click event.

 

If during that 5 seconds, you click in the area previously occuppied by the start button, you will see it temporarily become visible and enabled during that little 100ms end-of-loop wait, and then become invisible again, implying the click was queued up.

 

Atleast that is the behavior I see on my machine.

 

Thanks...

-Umar.

 

0 Kudos
Message 3 of 13
(2,931 Views)

All you attached is the project file. You didn't attach any of the code itself.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 13
(2,928 Views)

TO the best of my knowlege, a mouse down on a disabled control will still trigger an event. I have used this to display a message like "You must be logged in to use this button".

 

Options are to check the state of the disable before acting inside the event or to use dynamic event registration to only register for the event when you want the event to fire. Whn not registered no events.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 13
(2,924 Views)

Something like this

Tim
GHSP
0 Kudos
Message 6 of 13
(2,917 Views)

Huh...  I thought my project file included the code.  Perhaps I attached it before saving it.

 

I'm modified the code to use event registration as per the other post, but it is still not working.

0 Kudos
Message 7 of 13
(2,907 Views)

Tim...  I am unable to open your 'Double Click Example.vi' since it was built in LV 10.0, and I am using 8.2.

 

Now, perhaps it is not a possible problem to solve in 8.2, but if the diagram is simple enough for it to be feasible,

can you send me a screenshot of your diagram?

 

Thanks...

-Umar..

 

0 Kudos
Message 8 of 13
(2,904 Views)

@umars wrote:

Huh...  I thought my project file included the code.  Perhaps I attached it before saving it.

 

I'm modified the code to use event registration as per the other post, but it is still not working.


STOP just posting the lvproj. You've already been told that this does not include the actual VIs.

 

If you are using the Mouse Down event, you might want to consider changing that to a Value Change event. You will NOT have the problem of firing events when the button is disabled.

 

You might also want to ask about changing your blue bar (NI employee).

 

 

0 Kudos
Message 9 of 13
(2,895 Views)

If you have a LV project, you should build a Source Distribution and ZIP files are just fine.

 

Changing to the Value Change event is one possibility, but I am more of a fan of Set Busy.vi and Unset Busy.vi.

 

Using the Mouse Events can be subtle.  Let's say you disable a control, do your work, then enable the control inside an event case.  Clicks that you made are queued up, and processed after the slow work is done.  By this time, the control is enabled again so you are unable to filter those events.  A possible solution is to use a Producer/Consumer design so the events are always handled in near realtime while the slow work is done by the consumer loop.

 

If you want to block the whole GUI during a slow operation I suggest using the Busy cursor.  If you only want to block specific controls, then consider 'Value Change' events if possible, or a P/C design. 

 

Unofficially, on those occasions where I really want to use the Mouse click events and need to selectively block them out I will sometimes strategically place a transparent picture control.

0 Kudos
Message 10 of 13
(2,885 Views)