Implementing OnKey events

Post a reply

In an effort to prevent automatic submissions, we require that you complete the following challenge.
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review

Expand view Topic review: Implementing OnKey events

Implementing OnKey events

by m42i » Thu Oct 03, 2013 6:46 am

I'm trying to register some keyboard shortcuts for a NewForm panel but I can't get it working.

Here is what I've tried:

Code: Select all

Sub OnStartup
    Set UI = SDB.UI

    Set MainPanel = UI.NewForm
    MainPanel.BorderStyle = 2
    MainPanel.Common.Align = alClient
    Script.RegisterEvent MainPanel.Common, "OnKeyUp", "MainPanelKeyUp"
End Sub

Sub MainPanelKeyUp(Key, State)
    SDB.MessageBox "Key pressed: " + CStr(Key), mtInformation, Array(mbOk)
End Sub
I also tried using MainPanel instead of MainPanel.Common with no luck.