Cursor hook and info box
KZarzana
I have a hook for a graph that executes some code when the cursor moves. This works fine when I move the cursor with the arrow keys or manually. However, if I enter a new value for the cursor into the Info Box and press enter, the cursor moves but the cursor hook is not called. The only event that seems to get triggered is "deactivate" when I click on the Info Box. The sample code below should reproduce this. I'm using Igor 8.0.3.3.
FUNCTION Set_Up()
Make/O/D/N=10 W_X=p, W_Y=p
Display/N=Graph_CSR_Hook_Test/K=1 W_Y vs W_X as "Graph_Csr_Hook_Test"
ShowInfo
Cursor/P A W_Y 3
SetWindow kwTopWin,hook(CSR_Hook)=Hook_Csr_Test
END
FUNCTION Hook_Csr_Test(s)
STRUCT WMWinHookStruct &s
GetWindow $s.winName activeSW
String activeSubwindow = S_value
STRSWITCH(s.eventName)
CASE "Cursormoved":
IF(CmpStr(activeSubwindow,"Graph_CSR_Hook_Test")==0)
Print "Cursor moved at "+Secs2Time(DateTime, 3)
ENDIF
BREAK
ENDSWITCH
END
Make/O/D/N=10 W_X=p, W_Y=p
Display/N=Graph_CSR_Hook_Test/K=1 W_Y vs W_X as "Graph_Csr_Hook_Test"
ShowInfo
Cursor/P A W_Y 3
SetWindow kwTopWin,hook(CSR_Hook)=Hook_Csr_Test
END
FUNCTION Hook_Csr_Test(s)
STRUCT WMWinHookStruct &s
GetWindow $s.winName activeSW
String activeSubwindow = S_value
STRSWITCH(s.eventName)
CASE "Cursormoved":
IF(CmpStr(activeSubwindow,"Graph_CSR_Hook_Test")==0)
Print "Cursor moved at "+Secs2Time(DateTime, 3)
ENDIF
BREAK
ENDSWITCH
END
Ah, you're right- an oversight when I added the ability to edit the point number.
This has been fixed for the next nightly build of Igor Pro 8. Use the Help->Igor Pro Nightly Build menu item or visit https://www.wavemetrics.net/Downloads/latest8/ directly to get the latest version. Be sure you get build #34127 or later.
Thank you especially for the nice example code. That makes it much easier for us to diagnose and fix the problem.
August 1, 2019 at 12:56 pm - Permalink
Thank you for the prompt fix to this!
August 1, 2019 at 01:34 pm - Permalink