LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Skip Key Up Event?

Hi All,

I have a simple subVI that automatically executes when my main app is run.  It's a simple splash ditty with up front choices for open, new, and cancel the splash.  It's a simple VI, I use an event structure for Value Change on the three buttons plus I catch Key Up to check for ESC to act as cancel and Panel Close to make sure all my exit routes are clean.

My problem is this:  When I select Open, I fire up the File Dalog VI to select a file.  If I use the ESC key to cancel the file dialog it fires the Key Up handler in my splash vi and cancels that as well.  So one keystroke of ESC is effectively kicking me out of the file dialog and my splash dialog.  If I click the cancel button in the file dialog everythig works fine.

Any ideas why the ESC action is passing thru the file dialog VI and making to back to the calling VI to trigger a key up event?

Runing LV 8.20 on WinXP.  I've also attached a screen shot of the esc handler in the splash VI.

Cheers,
Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
0 Kudos
Message 1 of 6
(3,212 Views)

Hi Greg,

Did you see Ton's Dynamic event registration Nugget ?

I think that shutting down the event while in the dialog will help.

Regarding "Any ideas why the ESC action .... "

I can only guess.

Ben

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

I just set up a simple VI to recreate the problem you're having, and I see the same behavior. I got around it by using the 'cancelled' output of the file dialog prompt. Wire this to a shift register and then read it in the 'Key Up' case. Invert it and AND it with 'if scancode == 1'. This way you'll be checking if the scancode is one AND the dialog wasn't cancelled. If this is the case, signal your cancel button.

Make sense?

Edit: I just realized this will disregard the first ESC press if you cancel the dialog by clicking the button, so it isn't complete. It might help get you started though.

Message Edited by Marc A on 04-25-2007 04:36 PM

0 Kudos
Message 3 of 6
(3,185 Views)
How about using the filter event for the key up and discarding it in the splash vi with the "discard if not frontmost" condition?


0 Kudos
Message 4 of 6
(3,183 Views)
Hi All,

Good input all the way around.  Upon further inspection and using your ideas I have learned a bit more.

1.  The file dialog appears to be responding to the key down event when ESC is pressed.  Leaving the key up to filter thru to my key up handler in the splash vi.
2.  Unless I'm blind, there is no key up filter event.  There is, however, a key down filter event.
3.  If I change my key up event to a key down event in my splash vi everything runs correctly.

Thaks for all the input.  It helped me get where I needed to go.

Cheers,
Greg Cole
“It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
0 Kudos
Message 5 of 6
(3,155 Views)

Hi Greg,

Good to see that your problem had got solved by changing the event from Key Up to Key Down.

See the below post in configuring the Key Down event.

http://forums.ni.com/ni/board/message?board.id=170&message.id=243437#M243437

I think if a control has got configured with both Value Change & Key Down events, only the Value Change gets triggered always.

See the attached VI. Toggle the Bool constant in the Timeout case & see the rewults.

If it needs to work, either it needs to have got its KeyFocus set to True or the Key Down event should be configured for the Vi itself, & not that particular control.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 6 of 6
(3,139 Views)