File Exchange

image thumbnail

Figures-menu adaption for standalone applications

version 1.2 (5.76 KB) by

Create dockable figures for standalones and disable or remove menu items from the figures container

2 Downloads

Updated

View License

As pointed out by Yair Altman in his very popular blog (http://undocumentedmatlab.com/), accessing the java properties of a figure window allows for making figures being dockable even in standalone applications. Unfortunately, the figures container contains menu items (Plot Browser, Figure Palette and Property Editor) which directly lead to crashes of the whole application.

To overcome this shortcoming, a function is supplied which removes the problematic (or unwanted) menu entries from the figures container. This is achieved by using a property change listener for the docking state of the figure. For this purpose, a figure creation functions is used for setting the listener as well as all other properties of the figure.

Additionally, a short test case is provided.

Comments and Ratings (3)

Thierry Dalon

Instead of DTDocumentBar = javaObjectEDT(figures_frame.getRootPane.getLayeredPane.getComponent(1).getComponent(1).getComponent(0).getComponent(0).getComponent(1).getComponent(0));
one could use the great findjobj:
hDocumentButtons=findjobj(container,’class’,'DTDocumentBar$DocumentButton’);
or for Matlab >=R2012a:
hTabs=findjobj(container,’class’,'DTDocumentTabs$Tab’);

JMenuBar.updateUI shall be added to refresh the menus.

Alexander Mering

Thanks Aurelien.
The main praise should go to Yair Altman how showed the route. I just discovered and removed the crashing items.

About the error: I extracted the functions from a larger project and forgot to rename the MousePressed Callback in the Callback_DockingFcn.

I made an update and changed
Cbrake_Callback_Diagrams_DockingFcn -> Callback_DockingFcn

Nice submission . Starting the desktop from a deployead application is amazing!!).
Under R2012b , Windows XP in deployed mode , I get only once this error :
Undefined function or variable 'Cbrake_Callback_Diagrams_DockingFcn'.
Error in Callback_DockingFcn/@(source,event)Cbrake_Callback_Diagrams_DockingFcn

but if works as expected , I mean ... figures can be docked in deployed mode.
Thanks

Updates

1.2

Removed an error from the MousePressed_Callback for the DTDocumentBarButtons

MATLAB Release
MATLAB 7.13 (R2011b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video