How can I create a toolbar in a GUI created using GUIDE in MATLAB?

9 views (last 30 days)
I have created a GUI using GUIDE. When I run the program, I do not see the toolbar in the activated figure. I would like to have the figure toolbar displayed by default. The menubar for the activated figure can be made visible or invisible by default with the help of the property MenuBar. I am not able to find a property for the Toolbar.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 20 Jan 2010
This enhancement has been incorporated in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
There is an undocumented property called 'Toolbar' for the figure that can be set to 'figure' so the toolbar will be displayed by default. Refer the following steps to achieve this:
1. Right-click in the GUIDE figure. (Click in the gray area with the grid lines. Do not right-click on any uicontrols.)
2. Select View Callbacks -> CreateFcn
3. This will create a new callback function in your corresponding GUI program file.
4. In this function include the following code:
set(hObject,'toolbar','figure');
where h refers to the figure handle. In version 6.1 and earlier, the default is h; after 6.1 it is hObject.
5. Save your changes and run your code. You will see the toolbar in the figure.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!