07-06-2012 07:23 AM
The attached file includes a sub-vi (Dropdown Menu) with its wrapper code isolated from the rest of the program and used as the main vi (Dropdown Ring).
I currently have three ways of 'exiting' the dropdown menu; two that work and one that doesn't. The one that doesn't is the keydown event. This is currently defaulted as the Escape key, but I haven't had any joy with other keys either.
Could someone possibly check my code to see what I might be doing wrong? At the moment, the keydown event never seems to occur which has me rather confused as to why.
There are a few 'extra' controls on the main vi's front panel, but these are mainly for debugging purposes.
Attachment: (LabVIEW 8.5)
Solved! Go to Solution.
07-06-2012 08:53 AM
Hi James,
two points:
- the ESCAPE key isn't working because your subVI doesn't get focus. You first have to click into the selection area before key down events are recognized in the subVI...
- I would include the setting of the origin back to (0,0) into the subVI. While playing around a moved the FP of the VI, which leads to an "empty" window shown later on. (just for safety...)
07-07-2012 05:40 PM
That's a good point about setting the origin to (0,0) - I find it's best to try to account for every eventuality when dealing with user inputs!
And thanks for pointing out why the Keydown event wasn't working. Is there a way to programatically give focus to a VI, or will that interfere with something else? (I'm not at the office again until Monday)
- James
P.S. As a personal opinion, do you think I even need the Keydown exit strategy as well as the two timed exits?
07-07-2012 11:02 PM
Try setting the menu subVI to "modal" in the customized window appearance properties. Now <escape> seems to work just fine.
07-09-2012 07:05 AM - edited 07-09-2012 07:07 AM
@altenbach wrote:
Try setting the menu subVI to "modal" in the customized window appearance properties. Now <escape> seems to work just fine.
That worked. I had to tweak the boundary calculations to account for the compulsory modal border, but it does what I need. 🙂
Including the new VI, for if anyone stumbles across this thread later.