However, I am creating a GUI programmatically, and I would like to just add the buttons from the default figure toolbar that I want (zoom in, zoom out, pan, data cursor) rather than add the whole toolbar then delete the buttons I don't want. It would be also be nice to be able to place the buttons wherever I wanted on the GUI but that is not a must have.
So far, I have ALMOST achieved the minimum goal by turning the figure toolbar on, then deleting ALMOST all the buttons. I just can't figure out how to delete the one that has the tooltip "Brush/Select Data". For example, if I do a finall(fh,'ToolTip','Brush/Select Data'), it will find the "ToggleSplitTool", but it doesn't return a handle to it, so I can't delete it.
% Get a handle to the standard plot toolbar.
tbh = findall(fh,'Type','uitoolbar');% Get handles to each button we don't want on the standard toolbar and DELETE
ptPlotToolsOn = findall(fh,'Tag','Plottools.PlottoolsOn'); delete(ptPlotToolsOn);ptPlotToolsOff = findall(fh,'Tag','Plottools.PlottoolsOff'); delete(ptPlotToolsOff);ttInsertLegend = findall(fh,'Tag','Annotation.InsertLegend'); delete(ttInsertLegend);ttInsertColorbar = findall(fh,'Tag','Annotation.InsertColorbar'); delete(ttInsertColorbar);ttLinking = findall(fh,'Tag','DataManager.Linking'); delete(ttLinking);ttRotate = findall(fh,'Tag','Exploration.Rotate'); delete(ttRotate);ttEditPlot = findall(fh,'Tag','Standard.EditPlot'); delete(ttEditPlot);ptPrintFigure = findall(fh,'Tag','Standard.PrintFigure'); delete(ptPrintFigure);ptSaveFigure = findall(fh,'Tag','Standard.SaveFigure'); delete(ptSaveFigure);ptFileOpen = findall(fh,'Tag','Standard.FileOpen'); delete(ptFileOpen);ptNewFigure = findall(fh,'Tag','Standard.NewFigure'); delete(ptNewFigure);% Get the handle for the zoom in button to remove the separator bar
ttZoomIn = findall(fh,'Tag','Exploration.ZoomIn');set(ttZoomIn,'Separator','off')
It seems like it may be possible with this: uitoolbar, but the only example given by TMW documentation is pretty useless.
Any ideas how to delete that ToggleSplitTool? Or are there better ways to do this? This seems a little clunky. I'd rather make a custom toolbar and add back the buttons that I want to use with their associated default native callbacks… I'm not sure if I need to get all the Cdata from those buttons to make new ones that do the same thing but are located elsewhere on the figure, etc. I think the callbacks are just part of the putdowntext function, so they are accessible, but I haven't tried going this far yet.
Best Answer