Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Catching Keyboard events AND getting the current value of an edit field

  • Catching Keyboard events AND getting the current value of an edit field

    Posted by Uwe Smidt on March 7, 2024 at 9:08 am

    Dear $all,

    I’m trying to implement a remote form based auto-type feature – please see my other post…

    My current problem is that I can catch the event the user pressing something like ‘Shift-F4’

    with

    client method ‘$init’:

    JavaScript:window.addEventListener(“keydown”,function(event) {__form.callMethodEx(“keydown”,0,event,event.keyCode) }, true);

    # the additional parameter event.keycode will be received as parameter in method keydown()

    and

    client method ‘keydown’:

    Switch p2

    Case 115 ## F4-Taste

    If ibShiftKey

    Calculate icKeyboardShortcut as ‘Shift-F4’

    Else

    Calculate icKeyboardShortcut as ‘F4’

    End If

    End Switch

    Calculate ibControlKey as p2=17 ## Control Key is 17, remember for next Key Event

    Calculate ibCmdKey as p2=91|p2=93

    Calculate ibShiftKey as p2=16

    Calculate ibOptKey as p2=18

    and

    client method ‘keyup’:

    If icKeyboardShortcut

    Do method handleKeyEvent (icText) ## icText is the instance variable bound to the edit field

    End If

    My problem is that the value of icText (the edit field) is not updated yet at the time when the keyboard event keydown or keyup are fired.

    So how can I catch the keyboard shortcuts AND have the current value of the edit field?

    Any ideas are greatly appreciated!

    Best regards

    Uwe

    Götz Krija replied 1 month, 1 week ago 2 Members · 1 Reply
  • 1 Reply
  • Götz Krija

    Member
    March 8, 2024 at 9:48 am

    Hi Uwe,

    I think you can do this without Javascript.

    Set the Edit control’s $systemkeys property to kTrue and check the pKeyList event parameter in evKeyPress.

    Götz

Log in to reply.