Active window keeps switching to command window
scaffold
I just upgraded to Igor7 on PC, and have found one feature frustrating. I have functions written that run through keyboard hooks (ie. typing "a" runs function "go()") , but in the new Igor, anytime I type a character in any other active window, the command window pops up as the active window and they character is typed into the command line. Any ideas on how to work around this?
Thanks and best,
Daniel
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
August 18, 2016 at 11:14 am - Permalink
Function KeyboardPanelHook(s)
STRUCT WMWinHookStruct &s
if(stringmatch(winname(0,3),"AnalysisWindow"))
switch(s.eventCode)
case 11: // keyboard hook
switch(s.keycode)
case 97: //key "a"
print "hi"
break
case 98: //key "b"
print "bye"
break
endswitch
endswitch
endif
return 1 // changed from "return 0"
end
August 18, 2016 at 02:45 pm - Permalink
0 means "didn't handle it, let Igor do the default action."
1 means "I handled it, Igor should not".
It looks like your code is claiming to handle all events that a hook function is called for.
This is unlikely to be what you want.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
August 19, 2016 at 11:34 am - Permalink