Keyfunction(lastkey) delayed

Posted by stingray70m on 09-Dec-2016 12:42

I have created a Telerik Radform with a Radtextbox. I'm trying to capture the carriage return event with KeyUp but it isn't recognizing it. I have tried KeyDown and KeyPress with any success as well.  If I put in message keyfunction(lastkey). pause. ...after the first few attempts it starts to work, almost like the pause is allowing the keystroke to catchup. I have tried pause(1) no-message but that doesn't help either.

Has anyone seen this before?

method private void iPASSWORD_KeyUp( input sender as System.Object, input e as System.Windows.Forms.KeyEventArgs ):

        define variable func as character format "x(6)" no-undo.

        func = keyfunction(lastkey).

        message func. pause.

        if trim(func) = "RETURN"  then do:

          LOGIN_AUTH().

        end.  

return.

end method.

Thanks 

Mark

Posted by Matt Gilarde on 09-Dec-2016 13:13

The AVM doesn't set LASTKEY for keypress events in .NET controls. You have to look at the KeyEventArgs object which is sent to your event handler.

METHOD PRIVATE VOID radTextBox1_KeyUp( INPUT sender AS System.Object, INPUT e AS System.Windows.Forms.KeyEventArgs ):

    IF e:KeyCode = System.Windows.Forms.Keys:Enter THEN
        MESSAGE "hi" VIEW-AS ALERT-BOX
    RETURN.

END METHOD.

All Replies

Posted by Matt Gilarde on 09-Dec-2016 13:13

The AVM doesn't set LASTKEY for keypress events in .NET controls. You have to look at the KeyEventArgs object which is sent to your event handler.

METHOD PRIVATE VOID radTextBox1_KeyUp( INPUT sender AS System.Object, INPUT e AS System.Windows.Forms.KeyEventArgs ):

    IF e:KeyCode = System.Windows.Forms.Keys:Enter THEN
        MESSAGE "hi" VIEW-AS ALERT-BOX
    RETURN.

END METHOD.

Posted by stingray70m on 09-Dec-2016 13:50

Awesome Thanks!

This thread is closed