alukindo Posted September 19, 2007 Report Share Posted September 19, 2007 Hi: Was checking LabVIEW settings which will allow tabbing to a check-box and toggle TRUE/FALSE value by pressing <RETURN KEY>. Seems that LabVIEW does not have a way to customize for this. Or perhaps I am missing something? I later found a way to do it in code. Thought I 'd share the code just in-case someone wishes to do the same. Note: The idea is to have users quickly fill-in a form with-out having to use the mouse Anthony Quote Link to comment
Karissap Posted September 20, 2007 Report Share Posted September 20, 2007 QUOTE(alukindo @ Sep 19 2007, 02:52 AM) Was checking LabVIEW settings which will allow tabbing to a check-box and toggle TRUE/FALSE value by pressing <RETURN KEY>. To toggle the true/false value you can right click on the button, go to properties then the Key Navigation Tab and in the toggle section choose "Return" from the drop down list. You can set the tabbing order of front panel objects by selecting Edit»Set Tabbing Order Quote Link to comment
alukindo Posted September 20, 2007 Author Report Share Posted September 20, 2007 Hi Karissap: Thanks for your suggestion. However, that setting only allows you to toggle just one check-box. It is not a setting that you can use for multiple check-boxes on a form. In that case all those other check-boxes will not respond to the return key except for the one that you last configured with that setting. Anthony L. Quote Link to comment
Ton Plomp Posted September 20, 2007 Report Share Posted September 20, 2007 QUOTE(alukindo @ Sep 18 2007, 06:52 PM) I later found a way to do it in code. I think the following code is better: http://lavag.org/old_files/monthly_09_2007/post-2399-1190181874.png' target="_blank"> Does anyone know why I get a variant value for a boolean datatype? Ton Quote Link to comment
Jeffrey Habets Posted September 20, 2007 Report Share Posted September 20, 2007 Why go through all the hassle.. Just use the spacebar when your checkbox has focus.. Besides the fact that you don't have to program it, it is more common user interface behaviour to use the spacebar for that. QUOTE(tcplomp @ Sep 19 2007, 08:01 AM) Does anyone know why I get a variant value for a boolean datatype? I guess it's because your boolean references are not strictly typed.. LabVIEW has no way of knowing whether the booleans you register dynamically have a mechanical action of switch or latch. Quote Link to comment
Ton Plomp Posted September 20, 2007 Report Share Posted September 20, 2007 QUOTE(Jeffrey Habets @ Sep 19 2007, 09:41 AM) Why go through all the hassle.. Just use the spacebar when your checkbox has focus..Besides the fact that you don't have to program it, it is more common user interface behaviour to use the spacebar for that. I guess it's because your boolean references are not strictly typed.. LabVIEW has no way of knowing whether the booleans you register dynamically have a mechanical action of switch or latch. Yes I know that, but it should not matter, the data-type should be boolean wheter it's a latch or switch (right?) A latch should fire an error if the wrong boolean type is used. I propose two have two boolean reference types: Switch Latch Ton Quote Link to comment
Jeffrey Habets Posted September 20, 2007 Report Share Posted September 20, 2007 QUOTE(tcplomp @ Sep 19 2007, 10:16 AM) Yes I know that, but it should not matter, the data-type should be boolean wheter it's a latch or switch (right?)A latch should fire an error if the wrong boolean type is used. I guess making the Value a variant is NI's way of saying: watch it, there's something special going on here.. You're actually not allowed to use the Value* properties for reading or writing a boolean that is in latch mode. If you try it, you'll get an error.. QUOTE(tcplomp @ Sep 19 2007, 10:16 AM) I propose two have two boolean reference types: Switch Latch Ton Yes, that would be nice.. But as it is now, there's only one boolean object with an attribute that lets it behave in different modes (instead of using inheritance hierarchy of various boolean controls), thus only one reference.. As a workaround to get strict types you could cast to a reference linked to one of the checkboxes like this: You could also filter the array of controls by looking at the Mechanical Action (private) property to makes sure you only get refs to the right controls. Quote Link to comment
Ton Plomp Posted September 20, 2007 Report Share Posted September 20, 2007 QUOTE(Jeffrey Habets @ Sep 19 2007, 02:03 PM) Yes, that would be nice.. But as it is now, there's only one boolean object with an attribute that lets it behave in different modes (instead of using inheritance hierarchy of various boolean controls), thus only one reference.. I've been thinking a little about this, what you expect is a read-only 'value' property for latches and a read/write for switches. But there's an issue. Value is a property of the 'Control' class... and not of a '...... Control'. So the Boolean latch class should disable the write property of a Control. And using a the 'dynamic casting' as you showed force me to use two event cases with the same contents. Ton Quote Link to comment
Jeffrey Habets Posted September 20, 2007 Report Share Posted September 20, 2007 QUOTE(tcplomp @ Sep 19 2007, 02:19 PM) I've been thinking a little about this, what you expect is a read-only 'value' property for latches and a read/write for switches.But there's an issue. Value is a property of the 'Control' class... and not of a '...... Control'. So the Boolean latch class should disable the write property of a Control. And using a the 'dynamic casting' as you showed force me to use two event cases with the same contents. I don't understand why you would need two event cases.. In this particular case we are only interested in checkboxes, and I expect these to be in switch mode, not latch.. For latch mode your event code would be of no use anyway since reading/writing of the boolean value property is not possible. So, just wire the array of strict bool-refs to the RegEvents node and you can handle all switch booleans in one event case. Quote Link to comment
alukindo Posted September 20, 2007 Author Report Share Posted September 20, 2007 QUOTE(Jeffrey Habets @ Sep 19 2007, 03:41 AM) Why go through all the hassle.. Just use the spacebar when your checkbox has focus. Hi Habets: Thanks! I actually tested a number of keyboards presses including shift enter but MISSED the space bar. Now I can remove the code from the form. It is not needed at all. Again thank you for pointing this out. :thumbup: Anthony Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.