|
On Feb 4, 3:07=A0am, "Vihang Patil" <vihang_pa...@yahoo.com> wrote:
> "german " <nos...@yahoo.com> wrote in message <fo1d15$9b3
>
> $...@fred.mathworks.com>...
>
> > hi
> > I recently upgraded to 2007b
> > I used the function maximize.m (file exchange)
> > to maximize the main gui window when it opens.
> > now it is not working anymore.
> > I also have problems with windows that should open in
> front
> > are now sent backwards.
> > any ideas?
> > thanks
>
> Hello
> You can use this Java hack
> h =3D figure;drawnow;
> j =3D get(h,'javaframe');
> jfig =3D j.fFigureClient.getWindow; %undocumented
> jfig.setAlwaysOnTop(1);%places window on top, 0 to disable
> jfig.setMaximized(1); %maximizes the window, 0 to minimize
>
> HTH
> Vihang
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This doesn't exactly work if you're using GUIDE. I put this code into
my m file. The main window in GUIDE is called figMain. The macro is
called MyMacro (I changed the actual name).
% --- Executes just before MyMacro is made visible.
function MyMacro_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 MyMacro (see VARARGIN)
% Choose default command line output for MyMacro
handles.output =3D hObject;
%=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
% --- My Startup Code
--------------------------------------------------
% Clear old stuff from console.
clc;
h =3D handles.figMain;
drawnow;
j =3D get(h,'javaframe');
jfig =3D j.fFigureClient.getWindow; %undocumented
jfig.setAlwaysOnTop(1);%places window on top, 0 to disable
jfig.setMaximized(1); %maximizes the window, 0 to minimize
% Update handles structure
guidata(hObject, handles);
% --- End of My Startup Code
--------------------------------------------------
Now, when it hits the jfig.setMaximized line, it does indeed maximize
the window, but then it continues on doing guidata(hObject, handles);
plus a bunch of other hidden MATLAB stuff before it actually turns
control of the window over to the user. Somewhere in that, it un-
maximizes the window. Nice try though. I'd still like a solution.
Regards,
ImageAnalyst
|