I want to add a new toggle button to the figure toolbar. When it is clicked, I want to “untoggle” any other buttons that were toggled. E.g, if the “rotation” or “zoom” toggle buttons were pressed, I want to untoggle them and their effect.
Simply getting all their handles does not work, as this does not deactivate their effect.
I want to add a new toggle button to the figure toolbar. When it
Share
You should first find all of the children of toolbar. You can do it by the following command (Assuming that
currentToggleButtonis a handle to current toggle button):Then do the following:
Of course, you need to return the state of your current button to
on.By the way, if you are using GUIDE, you can add
zoom,rotateandpanas pre-defined tools. In that case, Matlab will handle the toggling automatically.In order to turn off the effect of zooming/pan/rotation, you can do:
or you can use another syntax version (as @Eitan also mentions)