- Undocumented Matlab - https://undocumentedmatlab.com -
uicontrol side-effect: removing figure toolbar
Posted By Yair Altman On October 7, 2009 | No Comments
Earlier versions of Matlab had an undocumented side-effect in the uicontrol function, of removing the figure toolbar if the figure’s toolbar property was set to ‘auto’ (which is the default value for figures).
In order to restore the toolbar, or prevent its removal in the first place, set your figure’s toolbar property to ‘figure’. This should preferably be done immediately after creating the figure, or in its *_OpeningFcn() function if the figure was created using GUIDE:
set(hFig,'toolbar','figure');
The uicontrol issue is now documented [1] in the latest Matlab 7.9 release (R2009b), although it was undocumented for many earlier Matlab releases. Nevertheless, the current documentation, coupled with the fact that this issue was widely reported in the CSSM newsgroup and so is not really innovative, made me hesitate before posting. But I’m currently on vacation and don’t have time for a more detailed article this week (I skipped last week entirely), so I apologize to anyone who feels disappointed. I promise to compensate when I get back from vacation…
A similar issue was reported for GUIDE-created figures [2], and was reportedly solved in Matlab 7.2 (R2006a).
Categories: Figure window, GUI, Low risk of breaking in future versions, Stock Matlab function, UI controls, Undocumented feature
Article printed from Undocumented Matlab: https://undocumentedmatlab.com
URL to article: https://undocumentedmatlab.com/articles/uicontrol-side-effect-removing-figure-toolbar
URLs in this post:
[1] documented: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/uicontrol.html#f52-578590
[2] reported for GUIDE-created figures: http://www.mathworks.com/support/solutions/en/data/1-19P5X/
[3] Customizing figure toolbar background : https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background
[4] Reverting axes controls in figure toolbar : https://undocumentedmatlab.com/articles/reverting-axes-controls-in-figure-toolbar
[5] Figure toolbar components : https://undocumentedmatlab.com/articles/figure-toolbar-components
[6] Figure toolbar customizations : https://undocumentedmatlab.com/articles/figure-toolbar-customizations
[7] Adding a search box to figure toolbar : https://undocumentedmatlab.com/articles/adding-a-search-box-to-figure-toolbar
[8] Customizing the standard figure toolbar, menubar : https://undocumentedmatlab.com/articles/customizing-standard-figure-toolbar-menubar
Click here to print.
Copyright © Yair Altman - Undocumented Matlab. All rights reserved.