Function MyHook(s) STRUCT WMWinHookStruct &s Variable hookResult = 0 switch(s.eventCode) case11: // Keyboard prints.keycode break endswitch return hookResult // 0 if nothing done, else 1 End
If the panel is the active window, then pressing one of the arrow keys gives a keycode printed in the command window.
(In case it is important, this is on a PC, using windows 7).
HTH,
Kurt
Did you try it? It works for me on my Macintosh. From the documentation for Named Window Hook Functions:
"Int32 keycode ASCII value of key struck. Function keys are not available but navigation keys are translated to specific values and will be the same on Macintosh and Windows."
The codes aren't given there, but an experiment should reveal them.
NewPanel /W=(519,137,819,337)
SetWindow Panel0, hook(key)=MyHook, hookevents=0
EndMacro
Function MyHook(s)
STRUCT WMWinHookStruct &s
Variable hookResult = 0
switch(s.eventCode)
case 11: // Keyboard
print s.keycode
break
endswitch
return hookResult // 0 if nothing done, else 1
End
If the panel is the active window, then pressing one of the arrow keys gives a keycode printed in the command window.
(In case it is important, this is on a PC, using windows 7).
HTH,
Kurt
February 17, 2015 at 05:22 am - Permalink
Thanks, - but unfortunately I am on a Mac.
Strange
February 17, 2015 at 08:02 am - Permalink
"Int32 keycode ASCII value of key struck. Function keys are not available but navigation keys are translated to specific values and will be the same on Macintosh and Windows."
The codes aren't given there, but an experiment should reveal them.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 17, 2015 at 09:04 am - Permalink
Very best regards,
Strange
February 20, 2015 at 11:03 am - Permalink
http://www.igorexchange.com/node/6329
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
February 25, 2015 at 07:55 pm - Permalink