Window Hook and Window Focus
hegedus
My Question:
I am using the keys to toggle checkboxes instead of forcing the user to click with the mouse and that is working fine.
However if a key that is not trapped for in my hook is pressed it gets passed to the command window and the focus is shifted.
What do I need to do to prevent this and ignore the errant keystrokes and keep the focus on the main window.
I think you want to return 1 for all other keys.
One caveat here is that you might actually NOT want to do that for ALL keys. I haven't looked in the manual, but I imagine that catching certain "important" combinations might interfere with the normal/expected behavior of Igor.
July 28, 2015 at 04:32 pm - Permalink
I should also point out that on Windows checkboxes that have keyboard focus will respond to the Space bar. On Macintosh in Igor 7 this will also be true when you have Full Keyboard Access turned on.
On final note: if a control has focus (a SetVariable or Listbox may take keyboard focus, for instance) then the key press events go to the control and your window hook won't get them.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 28, 2015 at 05:13 pm - Permalink
I took the approach of just catching the keys around my designated shortcuts and passing them to the window hook with no function.
I found another alternative: Close the command window.
Andy
July 29, 2015 at 12:39 pm - Permalink