Cursor/M behavior when using window hooks
chozo
Tue, 05/13/2014 - 10:06 pm
I call Cursor/M to modify some properties of the cursor without changing it's position (which is also convenient for working with both traces and images, as I don't have to discern between Cursor/I and Cursor). But I noticed the "cursormoved" event in a window hook gets triggered for every cursor (i.e., A,B,C,D ...) on there, even if I only modify just one of them with the command of course. Is this a bug or a feature? Calling Cursor without the /M flag doesn't do this. If the explanation is not clear, I can try to construct an minimal example some time later. I am running Igor 6.34 on Windows 7.
A short code example would be nice indeed.
May 19, 2014 at 01:10 pm - Permalink
make/O testwave = p
display/N=test01 testwave
Cursor A testwave 30
Cursor B testwave 60
Cursor C testwave 90
SetWindow test01 hook(MyWindow)=Testhook
End
Function Testhook(s)
STRUCT WMWinHookStruct &s
if (s.eventCode == 7)
print s.cursorname
endif
End
Executing, for example,
Cursor/M A
after building the window will printA
B
C
May 19, 2014 at 05:46 pm - Permalink
Cursor/M A
supposed to do? You are not changing anything with this call.Even if the event should have been named "cursorchanged" instead of "cursormoved" the /M flag should not generate events for other cursors or if you haven't changed anything.
Sounds like a bug for me.
Thomas
May 20, 2014 at 12:30 am - Permalink
Regarding 1): Cursor/M could be used to trigger an update in the hook function, precisely without changing the current state.
May 20, 2014 at 03:16 am - Permalink
The running of hook functions is simply a byproduct of the update. It is not designed to trigger a specific cursor hook.
We could add some extra code to update only one cursor - probably would not break anything but you never know....
Larry Hutchinson
WaveMetrics
support@WaveMetrics.com
May 20, 2014 at 04:41 pm - Permalink