This discussion is archived
8 Replies Latest reply: Jan 29, 2013 6:10 AM by 987517 RSS

How key binding in Oracle Forms works?

987517 Newbie
Currently Being Moderated
Hi guys,

This is my first time @ this forum.

I tried to find documentation about this but no luck.

I am new to Forms. Nevertheless, I know that in order to use key binding in Forms, fmrweb.res file is used. BUT....

How the Form( client) know which key was pressed? Does the forms gets it from windows?

I mean ,what kind of info(http request??) is sent over network to server ?

Lets assume F12 is assigned as 113 key value.

What happens over network when user clicks on keyboard F12?

Is there any info about this?

I read that when client accesses Forms application for the first time, java run-time classes bundled in JAR files are downloaded to client JRE cache. These files include frmall.jar, frmwebutil.jar and jacob.jar. This tells me there no conf files for client , only .class

To summarize my complicated question:) : I would like to know how my form knows what was pressed, before it send this data to server, which will read fmrweb.res and understand in the end the actual functionality

Thanks for your replies
  • 1. Re: How key binding in Oracle Forms works?
    Michael Ferrante (Oracle) Guru Moderator
    Currently Being Moderated
    Let me start by saying "Welcome to the Oracle Forums" and more specifically to "Forms". Before going much further, I would recommend that you review the following page as it will help you to get the most valuable replies possible.

    http://blogs.oracle.com/shay/entry/10_commandments_for_the_otn_fo

    As for what you are asking, I am guessing that there is a more specific, underlying question you are asking. Is how Forms capturing key strokes internall really important? What are you trying to accomplish? The simple answer from a fairly high level is that the java client applet (frmall.jar) monitors for client activity (mouse clicks, keyboard actions, etc) and sends that information to the server. It is the Forms runtime process (frmweb) which is running on the mid tier that reacts (as required) to that event. So, it is the runtime process using the resource file and not the client. Also, you referred to frmwebutil.jar and jacob.jar. These files are only used for WebUtil enabled forms. The only file required for all applications is frmall.jar

    If your real question is, how to I doing something in my application as a result of a particular key press, then the answer to most of that is in the comments listed in fmrweb.res. Here is one example of how it works.

    Let say you wanted to have your app do something custom when F2 is pressed. In fmrweb.res, assign F2 is assigned to Forms function. Specifically a custom function. This would be one of the ones shown as "Function X". You can choose any one you like as these are not related to the key. In other words, the key F2 has no direct relationship with "Function 2" unless you decide to set it up that way. "Function 2" refers to the trigger in your form. So let's related the F2 key with Function 6. You entry in fmrweb.res would look something like this:
    113  : 0 : "F2"  : 88 : "Function 6"
    Here's how this entry works:
    <blockquote>1. The 113 directly relates to the java awt key event 113
    2. The 0 indicates that no modifiers are to be included. This means that the only key pressed will be F2. There will be no Shift, Control, etc
    3. The next entry ("F2") is what is displayed when "Show Keys" is displayed from your form's help.
    4. The 88 is the internal ID number used by Forms which relates to an event. In this case, 88 refers to Function 6 or in other words, a KEY-F6 trigger in your form.
    5. The last entry is the description of what the key does. In other words, item 3 above indicates which key to press (to the user) and this entry explains what it does or represents. So in this case, you can change the wording "Function 6" to whatever you'd like.</blockquote>
    Again, most of this is explained in the comments of fmrweb.res although I understand it can be confusing.

    This to remember:
    <blockquote><li>You cannot have duplicate java events (with modifier). So be careful, if you duplicate an entry, likely nothing will happen. You can duplicate a java event so long as it has a modifier different from other similar entries. In other words, you can have a F2, Shift+F2, etc
    <li>Some keys are restricted by the OS and cannot be overridden. Exactly which ones will depend on your client OS and version. For example, on most Windows versions, you will not be able to override F1 however in some cases it may work. It will just depend on exactly which version you are using.</blockquote>
  • 2. Re: How key binding in Oracle Forms works?
    987517 Newbie
    Currently Being Moderated
    Hi thank you for your welcome and great answer.

    You were right, there is a more specific question. How Forms capturing key strokes::)?

    I am trying to build kind of sniffer to know that specific key was pressed and do something about it in my application. Its important for me to handle key-bindings dynamically.

    What I mean is that my app should not get this .res file and parse it for the needed keys and values. I want to catch it over network before/after server request

    I will to clarify this : F2 was pressed then java client applet get this key and sends this info to server where run-time process reacts by reading fmrweb.res ( am I right describing scenario?)

    But the real problem is how runtime gets this key? Binary, ASCII? how the HTTP requests looks like?. I work with WireShark tool and could not find any helpful packet...:(

    Not sure if I make my self clear...

    thank you Michael ,

    Nicko
  • 3. Re: How key binding in Oracle Forms works?
    Michael Ferrante (Oracle) Guru Moderator
    Currently Being Moderated
    The exchanges between client and middle tier are HTTP requests. As for exactly what those requests look like, I am not at liberty to discuss here. Further, this does not seem like an appropriate way to design an application unless you are attempting to bascally create some sort of hack. If you want to dynamically do something based on what key was pressed you can create a java bean and react in whatever way you'd like within the scope of the form. Here is an example/demo:

    http://forms.pjc.bean.over-blog.com/article-forms-11g-pjcs-sending-back-custom-events-to-forms-42491415.html
  • 4. Re: How key binding in Oracle Forms works?
    987517 Newbie
    Currently Being Moderated
    Oh no, no hack here:) Lets say my intention to have stand alone application to do something like in your example.

    Thank you for your help and example.

    I think after some reading I now understand what my question was...

    How client knows which key to send to server/runtime middle? Does the client reads keys from java.awt.event.KeyEvent ?

    Again, thx

    Edit : can make my answer show proper link:)

    http://docs.oracle.com/javase/1.4.2/docs/api/constant-values.html#java.awt.event.KeyEvent

    Edit 2 : What I said means client does not care at all what is defined at this .res file. Form will send to server the key user clicked, which will decide if there is an action for this key?

    Edited by: NickoPS on Jan 28, 2013 12:40 PM
  • 5. Re: How key binding in Oracle Forms works?
    Michael Ferrante (Oracle) Guru Moderator
    Currently Being Moderated
    It would seem that the easiest way to do this is using the java bean I suggested as a starting place. Trying to pick information from the network traffic will be sloppy and potentially prone to error. For example, if a need arose to SSL enable the environment then you network sniffing will probably no longer work. At least with a java bean you will have full control of the exchange and be able to react in a controlled way within the application.
  • 6. Re: How key binding in Oracle Forms works?
    987517 Newbie
    Currently Being Moderated
    Hi Michael ,

    I guess this is the proper way to do it as you mentioned. I definitely will review this and see if I can use it.

    Sorry for being so persistent, but can you confirm my last thought? Client/Forms sends(Always,even if some key is not defined in resource file) keys typed by user as they defined in java awt key event, without knowing anything about resource file?


    Thank you again
  • 7. Re: How key binding in Oracle Forms works?
    Michael Ferrante (Oracle) Guru Moderator
    Currently Being Moderated
    Yes, java.awt.event.KeyEvent

    http://docs.oracle.com/javase/6/docs/api/java/awt/event/KeyEvent.html
    http://docs.oracle.com/javase/6/docs/api/constant-values.html
  • 8. Re: How key binding in Oracle Forms works?
    987517 Newbie
    Currently Being Moderated
    Thx!!!

    Your answer combination and a little homework helps me much!

    Those links exactly what I was reading last night.

    All best,

    Nicko

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points