5.0

5.0 | 3 ratings Rate this file 118 downloads (last 30 days) File Size: 5.81 KB File ID: #15895

enable/disable figure

by Yair Altman

 

10 Aug 2007 (Updated 10 Aug 2007)

No BSD License  

enable/disable an entire figure window

Download Now | Watch this File

File Information
Description

Syntax:
  currentState = enableDisableFig(hFig, newState)
 
Description:
enableDisableFig sets the figure hFig's enable/disable state, which is otherwise supported by Matlab only for specific components but not figures. Using this function, the entire figure window, including all internal menus, toolbars and components, is enabled/disabled in a single call. Valid values for newState are true, false, 'on' & 'off' (case insensitive). hFig may be a list of figure handles.
 
Note 1: when the state is enabled, internal figure components may remain disabled if their personal 'enabled' property is 'off'.
 
Note 2: in disabled state, a figure cannot be moved, resized, closed or accessed. None of its menues, toolbars, buttons etc. are clickable.
 
enableDisableFig(newState) sets the state of the current figure (gcf).
 
state = enableDisableFig(hFig) returns the current enabled/disabled state of figure hFig, or of the current figure (gcf) if hFig is not supplied. The returned state is either 'on' or 'off'.
 
Examples:
  state = enableDisableFig;
  state = enableDisableFig(hFig);
  oldState = enableDisableFig(hFig, 'on');
  oldState = enableDisableFig(hFig, result>0);
  oldState = enableDisableFig(true); % on current figure
 
Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)
 
Warning:
This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7+, but use at your own risk!

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
FindJObj - find java handles of Matlab graphic objects, GetJFrame - Retrieves a figure's underlying Java frame

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Java
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
21 Jul 2008 norm thing

Thank you for this code! Works wonderfull on 2008a!

30 Sep 2008 Cat H

Does exactly what it says on the tin! I'm using it to prevent the user being able to create phantom waitbars by pressing the close button.

Many thanks!

24 Aug 2009 Cem

Yair,
     Thank you. It worked like a charm.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
gui tools Yair Altman 22 Oct 2008 09:22:46
example Yair Altman 22 Oct 2008 09:22:46
enable disable figure java Yair Altman 22 Oct 2008 09:22:46
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com