Jump to content

F Keys


jlada

Recommended Posts

I'm having a problem capturing keyboard events with an event structure.

The client wants F keys to switch a tab control. I want to use an event structure but am having trouble with this approach. Whatever I seem to do, I get peculiar results - the VI locks up or whatever. I am defining cases at the 'This VI' level and I seem to get the best results when there is a case defined for every possibility. It still isn't well behaved and I don't think this arrangement should be necessary. I've been sifting through the manual and have yet to figure out when it is necessary to register events.

I have an alternate plan of using keyboard VIs found at the NI site but, I would rather use the event structure if possible. Anybody willing to give a short lesson?

Thanks,

Jeff

Link to comment

Hello Jeff,

I am attaching a 7.1 VI which shows one way of doing this (let me know if you need a 7.0 version). As you can see, the VI is pretty straight-forward. I used the 'key down?' filter event. It doesn't have to be the filter event, but since function keys are usually used elsewhere it may be a good idea to use the filter event and discard the keys.

Hope this helps.

Regards,

Khalid Ansari

Download File:post-19-1088477941.vi

Link to comment

Thanks for the 7.0 VI Kahlid. I've tried this, or variations of it, without much success. You do have a couple of minor differences. Is there a reason that your tab control is inside the event case? I'll have to give that a try.

As to the NI policy; there is nothing in Kahlid's code which is specific to revision 7.1, so why should it not have run in 7.0? This is a policy designed to force programmers to pay the costs of upgrade whether it be necessary or not. I don't mind paying for improvements in software if I'm going to use them - the step up to 7.0 was worth the expense.

The arm-twisting tactics of being forced to pay for incremental software improvements, which only the most hard-core of users may be able to even appreciate does not endear me to any software company. I have the same pet peeve with Allen Bradley. I recently had to part with a bundle in software upgrade costs just because they came out with a new I/O card. But, I digress...

Jeff

Link to comment

Hi Jeff,

No, there's no specific reason for my tab-control being inside the Events structure. As you may know already, only latched booleans need to be inside (so that their values are read and they get popped-out on the front-panel correctly).

Does my VI from above run fine as-is for you? What specific issues are you're having with the Events structure? Is it possible to make a demo VI which exhibits these issues and post here?

If you haven't already, you may want to go through the 'Caveats and Recommendations when Using Events in LabVIEW' topic from LabVIEW's online help.

:arrow: About NI's policy of forcibly upgrading users to newer versions, I humbly disagree with you. Normally I prefer not to get into such issues, but in defense of NI, I must say couple of things: There's the 'Save for previous' option which allows one to save VIs for the older version. That's how I could get you a 7.0 VI though I am using 7.1. You were not forced to upgrade.

Another practical example is that the 7.1 version of the LabVIEW-DSC module, for instance, is a free upgrade. This is because there aren't as many new features in this version.

Anyways, we're all entitled to our opinions.

Regards and good luck with your project..

Khalid

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.