Igor has Trace Menus (TracePopup and AllTracesPopup)where you can add items to the menu when you right click on the traces themselves. I was wondering if there is another menu name where i can right click on the empty space of the graph and add items to that menu or if there was a command that I am missing? It would be a whole lot easier to click on the empty space then on the graph line.
If not I can attempt on creating contextual menu. Which I have been reading about.
I am just stuck on how i would go about placing a ticker in pre-made graphs. Any ideas?
Use the Examples in the PopupContextualMenu help as a starting point.
Try using the TableHook for a graph. You'd probably want to rename the function to MyGraphHook or something similar...
What is a "ticker"?
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
March 14, 2011 at 01:10 pm - Permalink
// adds hook to graph<br />
Function AllowSelectioninTopGraph()<br />
Setwindow kwtopwin hook(contextual)=contextualwindowhook<br />
end<br />
//Dynamic menus for the contextual menu<br />
Menu "TraceGraphMenu", contextualmenu, dynamic<br />
"Duplicate Graph", DuplicateTopGraph()<br />
"IdentifyTraces",/Q, GetTraces()<br />
End<br />
<br />
Menu "GraphMenu", contextualmenu, dynamic<br />
submenu "Graph"<br />
"Append Traces to Graph...", doIgorMenu "graph", "Append Traces to Graph"<br />
"Remove From Graph...", doIgorMenu "graph", "Remove From Graph"<br />
"-"<br />
"Modify Graph...", doIgorMenu "graph", "Modify Graph"<br />
"Modify Trace Appearance", doIgorMenu "graph","Modify Trace Appearance"<br />
"Reorder Traces", doIgorMenu "graph","Reorder Traces"<br />
"Modify Contour Appearance", doIgorMenu "graph","Modify Contour Appearance"<br />
"Modify Image Appearance", doIgorMenu "graph","Modify Image Appearance"<br />
"-"<br />
"Autoscale Axes", doIgorMenu "graph", "AutoScale Axes"<br />
"Axis Properties", doIgorMenu "graph", "Modify Axis"<br />
<br />
"Add Annotation", doIgorMenu "graph","Add Annotation"<br />
end<br />
Submenu "AJ Graph Additions"<br />
"Append a Wave"<br />
help = {"Append a wave to the current graph"}<br />
"Add cursor status", CursorReadCP()<br />
help={"Adds cursor status to the top graph"}<br />
"Duplicate Graph[s]",DuplicateGraphPrompt()<br />
"Duplicate Top Graph", DuplicateTopGraph()<br />
help={"Duplicates a graph"}<br />
"Place Model Info on Graph", PlaceModelInfoFunction()<br />
help = {"Place model info on selected graphs"}<br />
"Add Centerline Indicator", AddCenterlineIndicator()<br />
"Add Legend/1", Legend<br />
"Add Right Axes", AddRightAxis()<br />
"Label Axes", LabelAxes()<br />
"Label Right Axis", LabelRightAxis()<br />
end<br />
submenu "Trace"<br />
"Tracepopup", Menu "Tracepopup"<br />
end<br />
End<br />
<br />
Function Contextualwindowhook(hs)<br />
//Contextual menu code.<br />
//To Create a contextual menu without a premade menu use:<br />
// PopupcontextualMenu/c =(hs.mouseloc.h, hs.mouseLoc.v) "Select;Deseclect;Hello;"<br />
// Strswitch(S_selection)<br />
// case "Select":<br />
// ModifyGraph swapXY=1<br />
// break<br />
// case "Deselect":<br />
// ModifyGraph swapXY=0<br />
// break<br />
// case "hello":<br />
// print "hello"<br />
// endswitch<br />
//otherwise use /n and the name of the dynamic menu<br />
Struct WMWinHookStruct &hs<br />
Variable ret=0<br />
strswitch(hs.eventName)<br />
case "mousedown":<br />
variable iscontextualmenu = hs.eventmod%& 0x10<br />
//acontextual click is a right-click on windows or a control-click on MAC <br />
if( !isContextualmenu )<br />
break // allow normal click handling<br />
endif<br />
//allows a contextual menu on the trace<br />
String clickedTraceinfo = TraceFromPixel(hs.mouseLoc.h,HS.MouseLoc.v,"")<br />
If(Strlen(ClickedTraceInfo))<br />
string tn=StringbyKey("Trace",ClickedTraceInfo)<br />
PopupcontextualMenu/c =(hs.mouseloc.h, hs.mouseLoc.v)/N "TraceGraphMenu"<br />
break<br />
else //allows a contextual menu anywhere else on the graph<br />
PopupcontextualMenu/c =(hs.mouseloc.h, hs.mouseLoc.v)/n "GraphMenu"<br />
ret=1<br />
break<br />
endif<br />
endswitch<br />
return ret<br />
end<br />
May 4, 2011 at 12:40 pm - Permalink