Adsense Ad

Monday, 24 April 2017

Key Mapping in Oracle Forms



Key mapping or key binding defines how an application should respond when mapped key is typed. Usually application executes some function in repose. For example in Forms 6i, when user types F9, List of value is displayed to the user. It means that key F9 is mapped to function “List of Values”.

In oracle Forms this key mapping is defined in fmrweb.res file. Oracle provided a tool named “Oracle Terminal” in Forms 6i to customize key mapping. In Forms 10g and Forms 11g this file is directly editable. In Forms 11g this file can be located at following location

$Instance_home/config/FormsComponent/forms/admin/resource/US

In Forms 10, frmweb.res can be located in \forms directory

Enabling Key Mappings

A key binding connects a key to an application function. When you bind a key to a function, the program performs that function when you type that keystroke. You define key bindings in the fmrweb.res file in the ORACLE_HOME/admin/resource/<language directory> directory in UNIX, for example ORACLE_HOME/forms/admin/resource/US. For Windows, the location is ORACLE_HOME\forms.
By defining key bindings, you can integrate a variety of keyboards to make an application feel similar on each of them.On some platforms not all keys are able to be re-mapped. For example, on Microsoft Windows, because keys are defined in the Windows keyboard device driver, certain keys cannot be re-mapped. Key combinations integral to Windows, such as Alt-F4 (Close Window) and F1 (Help) cannot be re-mapped. As a general rule, keys which are part of the ÒextendedÓ keyboard also cannot be re-mapped. These keys include the number pad, gray arrow and editing keys, Print Screen, Scroll Lock, and Pause.
Note: If running with different NLS_LANG settings a different resource file will be used. e.g. NLS_LANG=GERMAN_GERMANY=WE8ISO8859P1 fmrwebd.res file will be used.There is a resource file for each supported language. To override this, pass parameter term=fullpath\filename.res to the Oracle Forms Runtime process.
It is possible to pass this parameter directly within the URL. For example:
http://hostname/forms/f90servlet?Form=test.fmx&term=fullpath\filename.res
You can also set this parameter in the formsweb.cfg file, for example:
otherParams=term=fullpath\filename.res

Customizing fmrweb.res

fmrweb.res is a text file which can edited with a text editor such as vi in UNIX or Notepad or Wordpad on Windows. Unlike Oracle 6i Forms, Oracle Terminal editor is no longer required. The text file is self-documented.

Note:
The customization is limited, particularly compared to character mode forms. You cannot edit fmrweb.res with Oracle Enterprise Manager Application Server Control.

Example change: Swapping Enter and Execute Mappings

In the section marked USER-READABLE STRINGS, find the entries with
122 : 0 : "F11" : 76 : "Enter Query"
122 : 2 : "Ctrl+F11" : 77 : "Execute Query"
and change them to:
122 : 2 : "Ctrl+F11" : 76 : "Enter Query"
122 : 0 : "F11" : 77 : "Execute Query"

Note:
By default fmrweb.res does not reflect the Microsoft Windows client-server keyboard mappings. It reflects the key mapping if running client-server on Unix X-Windows/Motif.

A file called fmrpcweb.res has also been provided which gives the Microsoft Windows client-server keyboard mappings. To use this file, rename fmrpcweb.res e.g to fmrweb_orig.res, and copy fmrpcweb.res to fmrweb.res. Alternatively use the term parameter as described above.

Exceptions/ Special Key Mappings

The following examples show special key mappings:
  • Section 1, "Mapping F2"
  • Section 2, "Mapping for ENTER to Fire KEY-ENTER-TRIGGER"
  • Section 3, "Mapping Number Keys"
  • Section 4, "Mapping for ESC Key to exit out of a Web Form"

Mapping F2

To map F2, change the default entry for F2, "List Tab Pages", to another key. Here is an example of the default entry:
113: 0 : "F2" : 95 : "List Tab Pages"
This must be explicitly changed to another key mapping such as the following:
113: 8 : "F2" : 95 : "List Tab Pages"
To map the F2 function to the F2 key, comment out the lines that begin with "113 : 0" and "113 : 8" with a # symbol and add the following lines to the bottom of the resource file:
113: 0 : "F2" : 84 : "Function 2"
113: 8 : " " : 95 : " "
Since a new function has been added which uses F2 by default, it is necessary to explicitly map this new function to something else in order to map the F2 key. This function was added to allow for keyboard navigation between the tab canvas pages and it defaults to F2. Even if it is commented out and not assigned to F2, the F2 key cannot be mapped unless this function, Forms Function Number 95, is mapped to another key.

Mapping for ENTER to Fire KEY-ENTER-TRIGGER

By default, whether deploying client-server or over the web pressing the ENTER key takes the cursor to the next navigable item in the block. To override this default behavior it is necessary to modify the forms resource file to revise the key mapping details.
Modify FMRWEB.RES and change the Forms Function Number (FFN) from 27 to 75 for the Return Key. The line should be changed to the following:
10 : 0 : "Return" : 75 : "Return"
By default, the line is displayed with an FFN of 27 and looks as follows:
10 : 0 : "Return" : 27 : "Return"
This line should NOT fire the Key-Enter trigger since the Return or Enter key is actually returning the Return function represented by the FFN of 27. The FFN of 75 represents the Enter function and will fire the Key-Enter trigger.

Mapping Number Keys

The objective is to map CTRL+<number> keys in fmrweb.res for numbers 0 to 9 and there are no Java Function keys mentioned for the numbers in fmrweb.res. The steps to be performed along with an example that shows the steps needed to map CTRL+1 to 'Next Record'
  1. List the java function key numbers that could be implemented in fmrweb.res file for the Key Mapping. For example:
    public static final int VK_1 = 0x31;
    
  2. The hexadecimal values have to be converted to their decimal equivalents before their use in fmrweb.res.
    In step (1), 0x31 is a hexadecimal value that has to be converted to its decimal equivalent. (Note:1019580.6) e.g:
    SQL> select hextodec('31') from dual;
    HEXTODEC('31') -------------- 49
  3. Use this decimal value for mapping the number key 1 in fmrweb.res For example, CTRL+1 can be mapped to 'Next Record' as:
    49 : 2 : "CTRL+1" : 67 : "Next Record"
    

Mapping for ESC Key to exit out of a Web Form

  1. Make a backup copy of fmrweb.res
  2. Open the fmrweb.res file present in the path ORACLE_HOME/FORMS and add the following entry in it:
    27 : 0 : "Esc" : 32 : "Exit"
  3. Ensure that you comment or delete the old entry
    #115 : 0 : "F4" : 32 : "Exit"
    The first number (115) might differ on different versions or platforms. When you run the Web Form and press the ESC key, then the Form will exit.

No comments: