How to recognize pressing of arrow keys

Hi,

I’m looking for a way to make an Igor program recognize the pressing of one of the arrow keys. Is that possible?

Strange
One way is as follows:
Window Panel0() : Panel
    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
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.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks very much, John, I shall surely give it a try.

Very best regards,

Strange