1. Restore a Window
- Posted by dcole Jun 26, 2011
- 1654 views
Hello Everybody,
I there a way to restore a window to it's original size (the one used in createEx(}) if the size is changed (not minimized}. Without using getRect/setRect?
Don Cole
2. Re: Restore a Window
- Posted by DerekParnell (admin) Jun 26, 2011
- 1606 views
I there a way to restore a window to it's original size (the one used in createEx(}) if the size is changed (not minimized}. Without using getRect/setRect?
I assume you mean by "if the size is changed" that the user manually changes the window size by using the mouse. In that case, the answer is no. It is your application's responsibility to know what size to restore the window to and you need to do that with setRect().
Why do you want to avoid using setRect()?
3. Re: Restore a Window
- Posted by dcole Jun 27, 2011
- 1524 views
I there a way to restore a window to it's original size (the one used in createEx(}) if the size is changed (not minimized}. Without using getRect/setRect?
I assume you mean by "if the size is changed" that the user manually changes the window size by using the mouse.
No, I'm changing the size with setRect.
Why do you want to avoid using setRect()?
Because I thoght I saw somewhere that you could do it with one command. Rather than:
sequence s s=getRect(Window1}--get the original size setRect(Window1.10,10,1100,1100,1}--change the size of the window here with setRect() setRect(Window1, s[1],s[2], s[3]-s[1], s[4]-s[2],1)}--restore to original size
But I can't find that procedure anymore. It might have been showWindow(Window1,SW_RESTORE). But that only works if one uses SW_MINIMIZE to change the window size.
What I'm trying to do is blowup a window and it's EditTexts and the EditTexts' fontsize. Then restore them back to their original sizes. Is there an easier way of doing this?
Don Cole
4. Re: Restore a Window
- Posted by DerekParnell (admin) Jun 27, 2011
- 1555 views
Is there an easier way of doing this?
No. Think about it ... restore to what? The system doesn't know which size is your application's default size for each window so that means you have to record what that size is. And thus its up to you to restore it back if its been changed.
However, you could make it a bit easier with these routines ...
procedure SetDefaultSize(integer win) setUserProperty(win, "DefaultSize", getRect(win)) end procedure procedure RestoreDefaultSize(win) sequence ds ds = getUserProperty(win,"DefaultSize") if length(ds) != 0 then ds = ds[1] setRect(win, ds[1],ds[2], ds[3]-ds[1], ds[4]-ds[2],1)}--restore to 'default' end if end procedure -- Now use it like this ... SetDefaultSize(Window1) setRect(Window1.10,10,1100,1100,1}--change the size of the window here with setRect() RestoreDefaultSize(Window1)
5. Re: Restore a Window
- Posted by dcole Jul 01, 2011
- 1481 views
Is there an easier way of doing this?
No. Think about it ... restore to what? The system doesn't know which size is your application's default size for each window so that means you have to record what that size is. And thus its up to you to restore it back if its been changed.
However, you could make it a bit easier with these routines ...
procedure SetDefaultSize(integer win) setUserProperty(win, "DefaultSize", getRect(win)) end procedure procedure RestoreDefaultSize(win) sequence ds ds = getUserProperty(win,"DefaultSize") if length(ds) != 0 then ds = ds[1] setRect(win, ds[1],ds[2], ds[3]-ds[1], ds[4]-ds[2],1)}--restore to 'default' end if end procedure -- Now use it like this ... SetDefaultSize(Window1) setRect(Window1.10,10,1100,1100,1}--change the size of the window here with setRect() RestoreDefaultSize(Window1)
Thanks Pete, Your code works pretty well and fine.
I guess you have to save all the original Windows and EditTexts attributes with getRect(}.
Don Cole