4.0

4.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 5.76 KB File ID: #39026

Figures-menu adaption for standalone applications

by

 

12 Nov 2012 (Updated )

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

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
27 Mar 2014 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.

15 Nov 2012 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

15 Nov 2012 Aurelien Queffurust

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
15 Nov 2012

Removed an error from the MousePressed_Callback for the DTDocumentBarButtons

Contact us