maximize

PURPOSE ^

MAXIMIZE maximize figure windows

SYNOPSIS ^

function maximize(h)

DESCRIPTION ^

 MAXIMIZE   maximize figure windows
 ====================================================================

        Berne University of Applied Sciences

        School of Engineering and Information Technology
        Division of Electrical- and Communication Engineering

 ====================================================================
                       maximize figure windows
 ====================================================================

 Author:    Alain Trostel
 e-mail:    alain.trostel@bfh.ch
 Date:      June 2007
 Version:   4.1

 ====================================================================

 function maximize(h)

 Input parameters
 -----------------
   h             handle(s) of the figure window


 Output parameters
 ------------------
   The function has no output parameters.


 Used files
 -----------
   - windowMaximize.dll


 Examples
 ---------
   % maximize the current figure
   ------------------------------
   maximize;


   % maximize the current figure
   ------------------------------
   maximize(gcf);


   % maximize the specified figure
   --------------------------------
   h = figure;
   maximize(h);


   % maximize the application window
   ----------------------------------
   maximize(0);


   % maximize more than one figure
   --------------------------------
   h(1) = figure;
   h(2) = figure;
   maximize(h);


   % maximize all figures
   -----------------------
   maximize('all');


   % maximize a GUI in the OpeningFcn
   -----------------------------------

   % --- Executes just before untitled is made visible.
   function untitled_OpeningFcn(hObject, eventdata, handles, varargin)
   % This function has no output args, see OutputFcn.
   % hObject    handle to figure
   % eventdata  reserved - to be defined in a future version of MATLAB
   % handles    structure with handles and user data (see GUIDATA)
   % varargin   command line arguments to untitled (see VARARGIN)

   % Choose default command line output for untitled
   handles.output = hObject;

   % Update handles structure
   guidata(hObject, handles);

   % UIWAIT makes untitled wait for user response (see UIRESUME)
   % uiwait(handles.figure1);

   % maximize the GUI
   set(hObject,'Visible','on');
   maximize(hObject);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function maximize(h)
0002 
0003 % MAXIMIZE   maximize figure windows
0004 % ====================================================================
0005 %
0006 %        Berne University of Applied Sciences
0007 %
0008 %        School of Engineering and Information Technology
0009 %        Division of Electrical- and Communication Engineering
0010 %
0011 % ====================================================================
0012 %                       maximize figure windows
0013 % ====================================================================
0014 %
0015 % Author:    Alain Trostel
0016 % e-mail:    alain.trostel@bfh.ch
0017 % Date:      June 2007
0018 % Version:   4.1
0019 %
0020 % ====================================================================
0021 %
0022 % function maximize(h)
0023 %
0024 % Input parameters
0025 % -----------------
0026 %   h             handle(s) of the figure window
0027 %
0028 %
0029 % Output parameters
0030 % ------------------
0031 %   The function has no output parameters.
0032 %
0033 %
0034 % Used files
0035 % -----------
0036 %   - windowMaximize.dll
0037 %
0038 %
0039 % Examples
0040 % ---------
0041 %   % maximize the current figure
0042 %   ------------------------------
0043 %   maximize;
0044 %
0045 %
0046 %   % maximize the current figure
0047 %   ------------------------------
0048 %   maximize(gcf);
0049 %
0050 %
0051 %   % maximize the specified figure
0052 %   --------------------------------
0053 %   h = figure;
0054 %   maximize(h);
0055 %
0056 %
0057 %   % maximize the application window
0058 %   ----------------------------------
0059 %   maximize(0);
0060 %
0061 %
0062 %   % maximize more than one figure
0063 %   --------------------------------
0064 %   h(1) = figure;
0065 %   h(2) = figure;
0066 %   maximize(h);
0067 %
0068 %
0069 %   % maximize all figures
0070 %   -----------------------
0071 %   maximize('all');
0072 %
0073 %
0074 %   % maximize a GUI in the OpeningFcn
0075 %   -----------------------------------
0076 %
0077 %   % --- Executes just before untitled is made visible.
0078 %   function untitled_OpeningFcn(hObject, eventdata, handles, varargin)
0079 %   % This function has no output args, see OutputFcn.
0080 %   % hObject    handle to figure
0081 %   % eventdata  reserved - to be defined in a future version of MATLAB
0082 %   % handles    structure with handles and user data (see GUIDATA)
0083 %   % varargin   command line arguments to untitled (see VARARGIN)
0084 %
0085 %   % Choose default command line output for untitled
0086 %   handles.output = hObject;
0087 %
0088 %   % Update handles structure
0089 %   guidata(hObject, handles);
0090 %
0091 %   % UIWAIT makes untitled wait for user response (see UIRESUME)
0092 %   % uiwait(handles.figure1);
0093 %
0094 %   % maximize the GUI
0095 %   set(hObject,'Visible','on');
0096 %   maximize(hObject);
0097 
0098 
0099 
0100 % check if dll-file exists
0101 if ~exist('windowMaximize.dll','file')
0102     error('windowMaximize.dll not found.');
0103 end
0104 
0105 % if no input parameters, get handle of the current figure
0106 if nargin == 0
0107     h = gcf;
0108 end
0109 
0110 % if one input parameter, check the input parameter
0111 if ischar(h)
0112     % check the string
0113     if strcmpi(h,'all')
0114         % get all figure handles
0115         h = findobj('Type','figure');            
0116     else
0117         % incorrect string argument
0118         error('Argument must be the correct string.');
0119     end
0120 else
0121     % check each handle
0122     for n=1:length(h)
0123         % it must be a handle and of type 'root' or 'figure'
0124         if ~ishandle(h(n)) || (~strcmp(get(h(n),'Type'),'root') && ...
0125                                ~strcmp(get(h(n),'Type'),'figure'))
0126             % incorrect handle
0127             error('Argument(s) must be a correct handle(s).');
0128         end
0129     end
0130 end
0131 
0132 % if handle is not the root
0133 if h ~= 0
0134     % for each handle
0135     for n=length(h):-1:1
0136         % create the temporary window name
0137         windowname = ['maximize_',num2str(h(n))];
0138 
0139         % save current window name
0140         numTitle = get(h(n),'NumberTitle');
0141         figName = get(h(n),'Name');
0142 
0143         % set the temporary window name
0144         set(h(n),'Name',windowname,'NumberTitle','off');
0145 
0146         % draw figure now
0147         drawnow;
0148         % maximize the window with the C function
0149         windowMaximize(windowname,get(h(n),'Resize'));
0150 
0151         % reset the window name
0152         set(h(n),'Name',figName,'NumberTitle',numTitle);
0153     end
0154 else
0155     % maximize the application window "MATLAB"
0156     windowMaximize('MATLAB');
0157 end

Generated on Thu 08-Apr-2010 14:35:09 by m2html © 2005