Graph Cursor
Ken
I am wondering if it is possible to simply click on a data point in a graph to select the data point, without having to drag the cursor from the bottom of the graph window onto the data point.
Also, can I execute a command upon selecting a data point with the cursor, instead of using a roundabout method of executing that command (e.g having the user press a button)?
Thanks.
DisplayHelpTopic "Window Hook Functions"
Keep reading through Named Window Hook Functions; we strongly recommend using the more-modern named hook functions.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 2, 2011 at 02:50 pm - Permalink
Function Hook(s)
STRUCT WMWinHookStruct &s
Variable hookResult = 0 // 0 if we do not handle event, 1 if we handle it.
switch(s.eventCode)
case 7: // "cursorMoved"
Desired_Function()
hookResult = 1
break
endswitch
return hookResult // If non-zero, we handled event and Igor will ignore it.
End
Within "Window Graph0(): Graph", I call the window hook function with "SetWindow Graph0,hook(MyHook)=Hook".
such that the desired action executes upon selecting a data point with the cursor. However, I am still confused as to how to make it so that I can move the cursor with just a left click of the mouse, without having to drag the cursor around. The cursor would ideally latch onto the closest point. I know eventCode = 5 is for mouseup, and once a cursor is locked onto a point, s.pointNumber and s.cursorName is generated. Also, s.mouseLoc.v and s.mouseLoc.h gives the mouse position. I haven't gotten much further than that.
June 8, 2011 at 02:45 pm - Permalink
You will use the Cursor operation to set the cursor to the right place.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 8, 2011 at 03:43 pm - Permalink
June 9, 2011 at 08:16 am - Permalink