From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

keyboard shortcut and lock panel

Hi,
I have this problem. I use LV8.2.1 win xp
I made a program to test a device. There are some buttons on the front panel, one is "Start", to obv start the test.
Mechanical action is set to "switch when pressed"
The event that handle that has a check on "lock front panel activity until this event completes".
I check this because I don't want user to accidentaly or on purpose click other things that will stay on event's queue, providing some kind of crap behaviour...
 
BUT
start button control has also a binding to "enter" key, because the test must be done many many times (production line) and it's better than click every time.
 
The PROBLEM is that hitting keyboard bypass in some way the lock front panel check, so as soon the test finishes, start button results immediately pressed and test starts again....
How can I do to avoid this?
thanks
0 Kudos
Message 1 of 10
(3,352 Views)

The problem is due to the fact that events are queued by Labview, so even if lock panel activity is blocked during an event X , new events can occur, and if they involve something on the front panel, theier effect on front panel is forbidden until the event X is finished, but those events stays in queue!

Is it possibile to set a filter event for "Enter key pressed" that DISCARDS itself from the queue UNTIL another event is in progress?!?!

0 Kudos
Message 2 of 10
(3,325 Views)

Ok,

I have tried one path, but it doesn't work

-> disable the button as first operation in the code of the event "Start button: value changed", then enabling the button as last operation. THIS DOES NOT prevent events to be enqueued, so I still have the bug of my first post.

Now I'm trying this:
1) create a reference to the button that generate the event
2) register the event outside the while loop
3) in the event code (<Test start>: value change), I unregister the event with "unregister for event"

This works in the sense that the button correctly works 1 time only.
Now I need to re-register the button again at the end of the event.

Can this work? Boh...

0 Kudos
Message 3 of 10
(3,299 Views)

Hi,

I hope that your last attempt has obtained a satisfactory .VI behavior.

If you still have that kind of problems, you should send me a very easy exemple about the manage of this event structure with this "Start button". Moreover I need that you highlight me again your purpose and the problems you have met: I have an unclear idea about your application.

Bye

Riccardo

0 Kudos
Message 4 of 10
(3,274 Views)
Attached source + images of front panel/block diagram of the core of my problem.
 
PROBLEM: hit "return" key during the test makes UNWANTED new tests! even if  I check the "lock front panel activity"
 
CAUSE: Labview event manager queue events, it is asynchronous, it's different behaviour from Microsfot Visual C#.
keyboard action is not front panel activity, so it fires an event, that is queued and executed just after the previous.
 
 
The solution I've found doesn't work, so if someone has a workaround...
we can talk about solutions to this problem.
Haven't found anything similar in the forum.
 
thanks
0 Kudos
Message 5 of 10
(3,265 Views)

I also tried it out even with the Set Cursor Busy function... still the Enter short-cut key configured for that Start button takes effect.

Only way I suppose is to disable that button on the first click or forst hit with Enter key; then do the process inside its event & then return to its normal state of False & enabled...

I ve done without using the Event Structure; I m pretty sure that even with the ES, it ll be the same behaviour.

Please see the attached VI in LV 7.1 & post your feedback here...

- Partha ( CLD until Oct 2024 🙂 )
Message 6 of 10
(3,255 Views)

Ok finally found a workaround.
Thanks Partha.
I attached 2 example, one using the disable button property doesn't work, like you suggested

But the set/unset busy works. I still don't understand why but it's ok Smiley Happy

Thanks I've found something that works otherways I was thinking about "flush event queue", "unregister/register event manually".... omg!!!

Message Edited by Slyfer on 06-04-2007 07:48 AM

Download All
0 Kudos
Message 7 of 10
(3,244 Views)

Unfortunately I discovered a bug so the problem is not completely solved Smiley Sad

Ok, consider the last file attachment "Interface that works.vi" (LV8.2.1).

The bug is that if you HOLD down the enter key for a couple of seconds (and you release it before the test finishes), the test WILL START AGAIN one more time, and this behaviour is unwanted.

Disabling the button DOESN'T solve.
Changing the property of the button into "switch when released" or anything else DOESN'T solve.
A new event "Start test: key repeat?" that discards itself is never generated.

How can I do this? Smiley Sad

0 Kudos
Message 8 of 10
(3,127 Views)
I have discovered that holding down the key (binded with a control) generate MULTIPLES "value change" events.
I just need to find a way to filter away, discards, all the events after the first one, but I am still not able
 
run attached file to see (LV8.2.1)
0 Kudos
Message 9 of 10
(3,122 Views)

Oh my God, I found it by myself...

I post the solution for the community
The key missing code was
1) set focus on toggle (advanced , key navigation, binding key to control options)
2) create another event for that button (F5 button in example attached), that handles the "key repeat?" event, and just discards it
3) wire the 100 ms for timeout

and now the problem is finally f***d
If they find another bug in this I give away my black lotus

0 Kudos
Message 10 of 10
(3,114 Views)