A script-enabled browser is required for this page to function properly.

Using the Keybinding API

To provide consistent, configurable, and performant keybindings in Forms, a keybinding API is provided. This API first downloads keybindings to the client. The API can then query the key sequence and return the corresponding form action or query the form action and return the corresponding key sequence.

Coding Standard Forms Actions

Standard form actions are defined in FormAction.java. These form actions are static instances of the class FormAction. For example, the Next Field form action can be addressed as FormAction.FA_NEXT_FIELD.

The constants for the various form actions in FormAction.java are obtained from frmweb.res. The following shows the beginning of the keybinding constants in FormAction.java.

  
  public class FormAction extends Property
  { 
     /* 
     ** The constants (or id's) for various forms actions have 
     ** been obtained from frmweb.res. These id's will not change. 
     ** New forms actions will be assigned new id's. 
     */ 
     public static final FormAction FA_NEXT_FIELD = new FormAction(1); 
     public static final FormAction FA_PREVIOUS_FIELD = new FormAction(2); 
     public static final FormAction FA_CLEAR_FIELD = new FormAction(3); 
     . 
     . 
     .
  

The following is the list of all the static constants for keybindings included in the FormAction.java class.

FA_NEXT_FIELD
FA_PREVIOUS_FIELD
FA_CLEAR_FIELD
FA_UP
FA_DOWN
FA_SCROLL_UP
FA_SCROLL_DOWN
FA_EDIT
FA_RETURN
FA_LIST_OF_VALUES
FA_HELP
FA_EXIT
FA_SHOW_KEYS
FA_COMMIT
FA_NEXT_PRIMARY_KEY
FA_CLEAR_RECORD
FA_DELETE_RECORD
FA_DUPLICATE_RECORD
FA_INSERT_RECORD
FA_NEXT_SET_OF_RECORDS
FA_NEXT_RECORD
FA_PREVIOUS_RECORD
FA_CLEAR_BLOCK
FA_BLOCK_MENU
FA_NEXT_BLOCK
FA_PREVIOUS_BLOCK
FA_DUPLICATE_FIELD
FA_CLEAR_FORM
FA_ENTER_QUERY
FA_EXECUTE_QUERY
FA_DISPLAY_ERROR
FA_PRINT
FA_COUNT_QUERY
FA_UPDATE_RECORD
FA_FUNCTION_0
FA_FUNCTION_1
FA_FUNCTION_2
FA_FUNCTION_3
FA_FUNCTION_4
FA_FUNCTION_5
FA_FUNCTION_6
FA_FUNCTION_7
FA_FUNCTION_8
FA_FUNCTION_9
FA_LIST_TAB_PAGES

Using the KeyBinder API

Use the KeyBinder API to download keybindings and get a requested form action or key sequence. The following is an overview of the process:

  1. Execute downloadKeyBindings() in your start-up code.
  2. Use isKeyBindingsAvailable() to test if the keybindings are available on the client.
  3. If the keybindings are available, use getKeySequence(FormAction action) to get the key sequence for the requested form action,

    or

    use getFormAction(KeyEvent event) to get the form action for the requested key sequence.

Use the following KeyBinder.java API methods:

Example of the KeyBinder API

This method gets the form action corresponding to a requested key sequence. The following example shows programming pertinent to the use of the KeyBinder.java API to get the form action from the keys pressed.

  
  KeyBinder.downloadKeyBindings(); // get bindings from server

Then in a text field's processKeyEvent(KeyEvent e) implementation, this handles events:

  
  // If we have key bindings, see whether this event maps to
  // one that we care about.
  // If it does, record which event it is with the name of
  // the action that goes with it.
  // Many actions can be invoked by buttons, key presses,
  // and/or menu selections...
  if (KeyBinder.isKeyBindingsAvailable())
      {
        String actionName;
        FormAction fact = KeyBinder.getFormAction(e);
  
        if (fact == (FormAction) null)
          {
             // if no binding found, issue message.
             system.out.printer("No binding found.");
          }
        else if (fact == FormAction.FA_LIST_OF_VALUES)
             actionName = "LOV";
        else if (fact == FormAction.FA_EDIT)
             actionName = "FLDEDIT";
        else if (fact == FormAction.FA_EXIT)
             actionName = "CANCEL";
        else
          {
          }
          .
          .
          .

How to Add JavaBeans by Writing Your Own Java Code

Including a JavaBean and Custom Controls