LV2013, Win7
My app has several non-modal windows, some of them resizable.
When the app shuts down, I want to save the position and size of these windows and restore them the next time it starts up, so that things are just as you left them.
I convert the FP.Bounds into a string, and save that in an INI file.
My customer wants to remember whether the window is MAXIMIZED or not, and restore it that way if so.
I realize that there is a FP.STATE property that I need to pay attention to, but I'm looking at something else first.
Here's a scenario, where I CLOSE the window BEFORE I read the BOUNDS.
I open this window.
I set this window to minimum (500x150), and by eyeball, put the top left of the panel in the center of my screen (about 960x540)
I shut down. The position is saved as "L=942,T=506,R=1442,B=656".
I start up again. The window is restored to the same place. Great.
I then MAXIMIZE the window, and shut down.
The position is saved as "L=2,T=46,R=502,B=196".
Why? it stored the new TOP LEFT, but left the SIZE where it was ? ? ?
According to the help text. "If the panel is not open, this property returns the bounds in the posiition in which it was last saved".
Since I'm dynamically opening a reentrant clone, there is no "last saved" position.
Anyway, I tried forcing the FP.CLOSE to occur AFTER the BOUNDS are read.
Here's the same scenario:
I open this window.
I set this window to minimum (500x150), and by eyeball, put the top left of the panel in the center of my screen (about 960x540)
I shut down. The position is saved as "L=926,T=500,R=1426,B=650".
I start up again. The window is restored to the same place. Great.
I then MAXIMIZE the window, and shut down.
The position is saved as "L=2,T=46,R=1918,B=1078".
OK, so that's maximized.
But the trouble is, I've lost the original position/size. If I unmaximize this, there's no where to go - there is no other size to return to.
It just removes the border pixels and the thing is still full screen.
I don't want to have to record all the maximizing operations, and the bounds before and after.
If I try this with MINIMIZED, the BOUNDS don't change - the BOUNDS specify where it would be if you un-minimized it.
But that's not true for MAXIMIZED.
I suppose that I have to do this:
Record FP.STATE (Maximized, Minimized, Standard, Closed)
If state = Maximized
Set State to Standard
Record FP.Bounds.
It looks like that would restore the bounds from wherever they are stored while maximized.
QUESTION: Is there a better way? Is there a way to get to those stored bounds numbers without unmaximizing the window while I'm shutting down?