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
"german " <nospam@yahoo.com> wrote in message <fo1d15$9b3
$1@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 = figure;drawnow;
j = get(h,'javaframe');
jfig = j.fFigureClient.getWindow; %undocumented
jfig.setAlwaysOnTop(1);%places window on top, 0 to disable
jfig.setMaximized(1); %maximizes the window, 0 to minimize
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
Hello
You can use my code in a separate m file as follows, to make
it work
ex:
%supposes guimain.m is your main gui figure(application)
window. Then make gui_tocall_main.m as a new m file that
calls your guimain function, with following to make it work
function gui_tocall_main
h = guimain;drawnow;
pause(1);
j = get(h,'javaframe');
jfig = j.fFigureClient.getWindow; %undocumented
jfig.setAlwaysOnTop(1);%places window on top, 0 to disable
jfig.setMaximized(1); %maximizes the window, 0 to minimize
On Feb 7, 2:42=A0am, "Stephan Hoffmann"
<stephan.limitedhoffmann.KEINS...@de.bosch.com> wrote:
> The figure has to be visible. Otherwise this hint doesnt
> work.
Stephen:
The figure is/was visible. It showed up when the drawnow command was
executed. And your code maximized the window. The problem is that
there's additional code that gets executed when you're running a GUIDE-
associated m file that gets executed that UNMAXIMIZES the window. So
basically it undoes what your code did, and I don't know of any way
around it.
Thanks,
ImageAnalyst
ImageAnalyst <imageanalyst@mailinator.com> wrote in message
<df7f28e2-0087-4c8a-bd52-
c9e2b7547f10@i7g2000prf.googlegroups.com>...
> On Feb 7, 2:42=A0am, "Stephan Hoffmann"
> <stephan.limitedhoffmann.KEINS...@de.bosch.com> wrote:
> > The figure has to be visible. Otherwise this hint doesnt
> > work.
>
> Stephen:
> The figure is/was visible. It showed up when the drawnow
command was
> executed. And your code maximized the window. The
problem is that
> there's additional code that gets executed when you're
running a GUIDE-
> associated m file that gets executed that UNMAXIMIZES the
window. So
> basically it undoes what your code did, and I don't know
of any way
> around it.
> Thanks,
> ImageAnalyst
If you want to maximize a gui created by guide, you have to
maximize your gui after the gui is loaded completely.
e.g. by a extra m-file which starts your gui:
Public Submission Policy
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 Disclaimer prior to use.