
Control Table Entry with Graph Cursor

ikonen
You can also imagine changing how the line is selected: use a mouse click event with a hit test, for example. I went with the cursor instead because I figured I'd want a visual cue on the graph that I selected the point I thought I had, so even with a mouse click based selection I figured I'd end up programmatically moving a cursor to the selected point. Your mileage may vary.
Just guessing the supported Igor version. The limiting feature is probably the named window hook; I'm not sure when these were introduced.
Menu "Graph Linker" "Link Top Graph and Table", LinkGraphToTable(WinName(0,1), WinName(0,2)) end Function LinkGraphToTable(graphname, tablename) string graphname, tablename SetWindow $graphname, hook(csr) = HookGraphToTable, userdata(TableLink)=tablename End Function HookGraphToTable(s) STRUCT WMWinHookStruct &s Variable hookResult = 0 string graphname, tablename switch(s.eventCode) case 7: // CursorMoved tablename = GetUserData(s.winName, "", "TableLink") if (WinType(tablename) == 2) Modifytable /W=$tablename topLeftCell=(pcsr(A),-1),selection=(pcsr(A),0,pcsr(A),-1,pcsr(A),-1) else print tablename, "is missing, Delinking Graph" SetWindow $s.winName, hook(csr) = $"" endif break endswitch return hookResult // 0 if nothing done, else 1 End
To see how it works, copy and paste following code on the command line:
make /d /n = 10000 testX, testY testX = enoise(100) testY = exp(gnoise(1)) display testY vs testX ModifyGraph mode=1 ShowInfo make /t /n = 10000 labels labels = num2char(mod(p,26) + 65) edit testX, testY, labels
Select Graph Linker -> Link Top Graph and Table
and move the cursor around.

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More