Facility Control

 View Only
  • 1.  Onkeypress and onkeyrelease handles

    Posted 06-16-2020 11:41
    Hello ross support. I want to trigger function while pressing an keyboard key, and trigger other function while release that key. Is it possible? I saw the onkeypress and onkeyrelease handles but i dont understand how it works, and where i need to specify which key should be listened. Thanks!


  • 2.  RE: Onkeypress and onkeyrelease handles

    Posted 06-16-2020 17:40

    Hi Alex

    These functions will fire if the control they are attached to has application focus. If you'd like to use more of a keyboard shortcut, you're better-off using the "Trigger ID" feature and hooking it up to the keyboard actions via the DashBoard Preferences.

    If this is what you're interested in, please see "Triggering Tasks Externally" in the DashBoard User Guide.

    Cheers

    James


    #DashBoard


  • 3.  RE: Onkeypress and onkeyrelease handles

    Posted 06-16-2020 18:30

    Hello James and thanks for quick reply.
    The point it that i want to reveal element only while key is pressed, and hide it when the key is released. I know and used in past the keyboard shortcuts which fire gpi, but in that menu i didn't find an option to register onpress and onrelease shortcuts separately.


    #DashBoard


  • 4.  RE: Onkeypress and onkeyrelease handles

    Posted 06-18-2020 11:30

    So, is it possible to do such a thing?


    #DashBoard


  • 5.  RE: Onkeypress and onkeyrelease handles

    Posted 06-18-2020 14:49

    I don't believe that is possible.  The keypress ogscript events only seem to trigger on things that are listening for keys (like text inputs). 

    And, as you say, the keyboard shortcuts only trigger on key press, and not on key release.

    I'm trying to think of another way to do it, but I can't think of anything.

     

     


    #DashBoard


  • 6.  RE: Onkeypress and onkeyrelease handles

    Posted 06-19-2020 15:31

    Presently, there is no way to do this. The script mechanism for keypress/keyrelease need to be bound to a component and the component needs to have focus to receive keyboard input. What you are talking about would work best with a global keyboard handler that could receive input regardless of what has the focus (though this often has side-effects too - like triggering things while typing an email for example).

    Depending on your use, you may want to consider an external control box that reports as a game controller - this would give you access to any buttons (and there are some controllers that are just collections of many buttons) as well as their up/down state.

    Hope this helps

    James


    #DashBoard


  • 7.  RE: Onkeypress and onkeyrelease handles

    Posted 06-20-2020 11:32

    Hello Ben and James,

    Ok, i got it. Maybe it would be good future option, that the keyboard shortcuts would be able to register onpress and onrelease.

    Thanks!

    Alex.


    #DashBoard