
Hook function on image disables menu functions

ChrLie
Function myHook(s) STRUCT WMWinHookStruct &s // get mouse position variable xpos = AxisValFromPixel("", "Bottom", s.mouseLoc.h) variable ypos = AxisValFromPixel("", "Left", s.mouseLoc.v) switch(s.eventCode) case 3: // handle left mouse click print xpos, ypos break endswitch return 1 End
and e.g.
make/N=(100,100) M_Image = p+q NewImage/N=TestImage M_Image SetWindow TestImage,hook(s)=myHook
Clicking on the image prints the mouse position on that image into the history.
Now I would like to use "Save Graphics" to save the image, but clicking onto that menu option (directly after clicking on the image) does not open the expected dialog.
Is this a bug or a feature?
I suspect you want to return 0. Are you intending to disable the various things you can do with mouse clicks in a graph?
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 23, 2015 at 09:39 am - Permalink
Thanks for pointing this out! Yes, almost everything is disabled!
Rather yes. In the actual case, clicking on an image pixel reveals a spectrum that is stored along the z-axis of a 3D wave. There is no reason to do modifications to the graph. But good to know why the above happens!
Thanks!
September 23, 2015 at 01:42 pm - Permalink
Did you return 0 for event code 9 (enable menu) and 10 (menu)?
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 24, 2015 at 09:27 am - Permalink
http://www.igorexchange.com/node/5677
If the choice is between 0 and 1 then I prefer the latter, since it took me more than a year to realise the effect ;-)
September 25, 2015 at 02:28 am - Permalink
I think you need to be more selective in the events for which you return 1. For the previous problem I think you can return 1 just for mouse events:
That will prevent the appearance of a marquee or any other mouse-related stuff. It will allow the menu events.
In Igor 7 there is a UI interaction control keyword with which you can disable features of a graph on a feature-by-feature basis.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 25, 2015 at 12:14 pm - Permalink