3 Replies Latest reply on Jul 14, 2015 3:06 PM by philmodjunk

    keyboard selection of radio button

    BSchanbacher

      Title

      keyboard selection of radio button

      Post

      Hi all,

      I was wondering if it's possible to use the keyboard (aside from using the arrow keys) to select a radio button.  For example, on a form, I have a field whose values come from a value list.  I would like the user to be able to tab into the field and make a radio button selection using the keyboard by pressing the first letter of the desired selection.  I'm not sure if this is relevant, but one more wrinkle is that these particular fields are not storing the actual value of the radio buttons, but rather a corresponding numeric value from another field in the value list table.

      I was surprised not to find any information on this already in the forum, but I may have missed it.  Is what I'm proposing possible?

      Any help is greatly appreciated

       

        • 1. Re: keyboard selection of radio button
          SteveMartino

          You could hardcode an OnObjectKeystroke trigger to capture the letter you want, then you could use Set Field to set the radio button field to the desired button.

          Keep in mind it's hard coded, so if you want to change the buttons, you have to change everything all the way thru the script

          edit:Here's a simple hardcoded example (don't forget to unzip-extract all):

          https://www.dropbox.com/s/a7fxk8hbc7uljzb/LabelDemo.zip?dl=0

          I'm not sure how to do it the way Phil suggests.

           

           

          • 2. Re: keyboard selection of radio button
            philmodjunk

            But since this appears to be a "use values from field" value list, it doesn't have to be hard coded. Your script code use that keystroke to find the corresponding record in the table that stores the values used in the value list and from there insert the correct corresponding ID type value. This then will change if the data in the value table is edited without a need for modifying the script.

            • 3. Re: keyboard selection of radio button
              philmodjunk

              Say you have two fields in your values table: ID, Name.

              Add a third field text, Letter,  that auto-enters this calculation: Left ( Name ; 1 ). Put a unique values validation on this field to make sure that each name starts with a unique letter.

              Set up an added occurrence of this table. I'll call it ValueTable|Letter.

              Link it to a text field in your layout table to get this relationship:

              Layout::pressedKey = ValueTable|Letter::Letter

              In your script, you can use this code:

              Set Field [Layout::pressedKey ; Get ( TriggerKeystroke ) ]
              If [Not (Isempty ( ValueTable|Letter::Letter ) //pressed key matches to a record ]
                 Set Field [ Layout::RadioButtonField ; ValueTable|Letter::ID ]
              End IF
              Exit Script [false]

              ExecuteSQL could also be used to get the ID and then you wouldn't need the Letter field nor the relationship.