Skip to main content
1-Visitor
September 26, 2013
Question

XUI buttons and shortcuts

  • September 26, 2013
  • 2 replies
  • 883 views
Hello everybody!!

Does anybody knows how can I add shortcuts to my XUI buttons? I'm trying
to implement some usability principles in my tool, and I want to provide
access to the user through the keyboard.

Thank you so much for your help and support. Regards!

Paulette Zorrilla

    2 replies

    1-Visitor
    September 26, 2013
    Look at the map command. I think you are talking about enabling keyboard
    commands (or shortcuts) like Control-C for copy to your environment. It is
    very easy to do. It gets tricky (not technically, but usability-wise) if
    you want to "steal" a default keyboard shortcut your users like.

    Anyhow, you would map a keyboard command to the same function that the
    button calls. You don't actually connect the keyboard command to the button
    itself. You do have to take care, depending on how/where you are creating
    this button, to be sure you are enabling the keyboard command in the right
    window. (And resetting it if it should return to a "normal" behavior after
    some act or state change.)

    map control-p execute ComposePDFFile;

    map control-r packagename::functionname();

    map control-alt-h find -t -q "<_touchup>";

    map control-alt-k {command1;command2;command3}

    etc.


    On Thu, Sep 26, 2013 at 10:07 AM, paulette zorrilla <
    paulette.zorrilla@oracle.com> wrote:

    > Hello everybody!!
    >
    > Does anybody knows how can I add shortcuts to my XUI buttons? I'm trying
    > to implement some usability principles in my tool, and I want to provide
    > access to the user through the keyboard.
    >
    > Thank you so much for your help and support. Regards!
    >
    > Paulette Zorrilla
    >
    18-Opal
    September 26, 2013
    Hi Paulette--

    You can also use the ampersand (&) to denote accelerator keys for menu items and buttons. For example, if you display the following as a XUI dialog:

    <window focus="clickme">
    <button id="clickme" label="&amp;Click" me&quot;=">
    <script ev:event="DOMActivate" type="text/javascript">Application.alert("Hi");</script>
    </button>
    <button label="&amp;No," click=" me&quot;=">
    <script ev:event="DOMActivate" type="text/javascript">Application.alert("Bye");</script>
    </button>
    </window>

    The user should be able to press Alt+C to activate the "Click Me" button, and Alt+N to activate the "No, click me" button.

    --Clay