Detecting a Maximized Window or How do I save my Window State?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting a Maximized Window or How do I save my Window State?

Jerome Chan
I'm adding some code to save a window's state (zoomed or not zoomed),
extent and position. I can't seem to find if a Window is zoomed or not.
Is there a way? The other two pieces of data are easy to locate.

Or should I just serialized the view / presenter / model and just use
that instead? :P


Reply | Threaded
Open this post in threaded view
|

Re: Detecting a Maximized Window or How do I save my Window State?

Blair McGlashan
"Jerome Chan" <[hidden email]> wrote in message
news:[hidden email]...
> I'm adding some code to save a window's state (zoomed or not zoomed),
> extent and position. I can't seem to find if a Window is zoomed or not.
> Is there a way? The other two pieces of data are easy to locate.
>
> Or should I just serialized the view / presenter / model and just use
> that instead? :P

I assume you are trying to do this to save the information to the registry
(etc), since the MVP system will do this automatically for windows saved in
the image, or into resources, the latter being just the serialized
representation of the view.

You can detect if a Window is zoomed or not using the IsZoomed() Win32
call - this is wrapped as UserLibrary>>isZoomed:, but there is no
convenience wrapper for it in the View class. Alternatively you could just
use View>>placement[:]. This uses the Get/SetWindowPlacement() API calls in
conjunction with a WINDOWPLACEMENT structure, that records all of the
details about the views position and size, including whether it is
maximized, minimized, etc. In fact it is this which is used by the MVP
system to save/restore the placement of windows.

Regards

Blair