Show All Shapes Toolbar Buttons

I want to add a new toggle button to the shapes panel. When it is clicked, I want to “untie” any other buttons that have been switched. For example, if the “rotate” or “zoom” buttons are pressed, I want to untie them and their effect. Simply getting all of their pens does not work, as this does not deactivate their effect.

+4
source share
1 answer

First you must find all the children of the toolbar. You can do this with the following command (Assuming currentToggleButton is the handle of the current toggle button):

  get( get(currentToggleButton,'Parent'),'Children'); 

Then follow these steps:

  set(children,'State','off'); 

Of course, you need to return the state of the current button to on .

  set(currentToggleButton,'State','on'); 

By the way, if you use GUIDE, you can add zoom , rotate and pan as predefined tools. In this case, Matlab will automatically switch.


To disable the zoom / pan / rotation effect, you can do:

  zoom('off') pan('off') rotate3d('off') 

or you can use a different version of the syntax (as @Eitan mentions)

  zoom off pan off rotate3d off 
+2
source

Source: https://habr.com/ru/post/1436628/


All Articles