Prevent dragging axis with mouse
gregorK
I have a rather specific issue - in my code I am using two (four) draggable lines to select a ROI. Now I have the problem that the starting position of these lines is at the graph region borders, which means if one is not careful enough one can accidentally drag the axis instead of that line, which is not especially user friendly ...
Therefore is it possible to somehow prevent axis dragging to a new position?
Thanks,
Gregor
You might consider instead using two cross-hair free cursors or the graph marquee to define your rectangular ROI.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 10, 2014 at 09:05 am - Permalink
No I am using the same solution as is written by you guys in "Image Line Profiles" (i.e. SetFormula looking at the S_TraceOffsetInfo string). I could try to rewrite everything as a hook function - I do not want to use the solution with the cursors ...
So if I understand correctly if there is a hook function returnig 1 there is no way to be able to drag the axis?
--
Gregor Kladnik
ALOISA beamline @ Elettra synchrotron
July 10, 2014 at 09:58 am - Permalink
Trying to do what you're doing using mouse events in a hook function would be very tricky. The only advantage would be that you can return 1 from a hook function to tell Igor that you handled the event and that Igor shouldn't do anything further. That would prevent the mouse clicks/drags from affecting the axis.
One possibility that occurs to me now is to use free axes and position them somewhat away from the plot area. That might give you the room you need to avoid landing on the axes.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
July 10, 2014 at 11:42 am - Permalink
Maybe this "fix axis position" could be a request for IGOR 7 as a new option in ModifyGraph for axes? :)
Cheers,
Gregor
--
Gregor Kladnik
ALOISA beamline @ Elettra synchrotron
July 10, 2014 at 11:47 pm - Permalink
SetVariable
option to precisely set the lines but also to get them away from the axes is usually an user-friendly way to do this.July 11, 2014 at 12:23 am - Permalink
I have set up the code in such a way that the mouse cursor changes its shape when it is close enough to the line to be dragged around as well as the lines are easily distinguishable from the data (2D data in black and white the lines in bright green). It is necessary to set the initial value at the border since the default value one is interested in is all the data (i.e. whole
q
range of the 2D wave data).Indeed I am using also this option as a read-out of the set value as well as being able to set the value independently from draging the lines (i.e. setting up the ROI).
--
Gregor Kladnik
ALOISA beamline @ Elettra synchrotron
July 13, 2014 at 01:32 pm - Permalink
Following your advice I have written a hook function for dragging around a line (represented by a wave) and now everything works as I wanted, i.e. one cannot move/drag the axis anymore.
Thanks John for your help!
--
Gregor Kladnik
ALOISA beamline @ Elettra synchrotron
July 14, 2014 at 01:55 am - Permalink