Storing and Retrieving Points

Ken G. Brown kbrown at tnc.com
Fri Sep 28 16:02:44 UTC 2001


What I am needing is a way of saving window location preferences for the
next time someone accesses and initializes everything. I'm thinking
everything will get shut down and go away and the next time initialization
is done, the user would like new windows of the same name to open in the
previous locations.
Thx.
Ken

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org
> [mailto:squeak-dev-admin at lists.squeakfoundation.org]On Behalf Of Tim
> Rowledge
> Sent: September 27, 2001 10:46 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: Storing and Retrieving Points
>
>
>
>
> "Ken G. Brown" wrote:
>
> > In general what would be the best way to store the location
> and extent of a
> > window, for restoration the next time it is opened as a new
> instance.
> I see that plenty of people have offered help on the first
> part of your
> mail, but not the second. So, here goes...
>
> I'll assume here that you are wanting to keep the position
> and extent of
> a window that you are about to close in order that some time later you
> can create a new window and place it in the same spot.  Your
> message is
> a little unclear though since you say "next time it is opened as a new
> instance" - if we are talking of a new instance, it cannot be
> 're'opened
> since it will not have been opened before. So the first thing to do is
> to make sure in your own mind whather you are closing windows and
> creating replacements later or if you are 'hiding' the
> windows and then
> reopening them later.
>
> In either case, you could simply keep a list of Rectangles. Rectangles
> can be created in a variety of ways including `Rectangle origin:
> foo at blah corner: fee at fie` or 3 at 4 extent: 400 at 211 - and many others. A
> look at the class will show the interstingly long list of
> things you can
> do with them.
>
> I suspect that you will want to associate some sort of
> name/label/identifier with each or you saved Rectangles, so consider a
> Dictionary. Let's say you use the window's label as the id,
> just for grins.
>
> 	savedWindowFrames := Dictionary new.
> 	savedWindowFrames at: thisWindow label put: thisWindow
> fullframe.
>
> tim
>
>
>





More information about the Squeak-dev mailing list