[Q] Open a morph on startup - but only once

Lex Spoon lex at cc.gatech.edu
Wed Sep 10 15:39:50 UTC 2003


Ingo Hohmann <uysl0l402 at sneakemail.com> wrote:
> Hi All,
> 
> I have a small personal wiki in, losely based on garden, and want it to 
> be opened whenever I startup squeak.
> 
> I have added it to the startup list, and it works, but there may already 
> be a wiki open in the project that is open on startup, and in this case 
> I want to just bring this to the front. (I open it like it is done in 
> Garden, I add morphs displaying my model to a system window).
> 

Have a class variable holding the main UI window.  Now you can fill in
the necessary code easily.  On startup, if the variable is nil, then
open a new window and save it in the variable.  If the variable is
non-nil but the window is not open, then open a new window.  If the
variable is non-nil and the window is open, then bring the window to the
front.

This approach only tracks instances that were created by the auto-start
code.  This may be good or bad, e.g. it's good if you want to allow
opening multiple servers and you only want one of them to be managed
automatically like this.

All this said, the requested behavior seems a little strange.  Why not
just leave it open and be done with it?  And if you close it, are you
completely sure that you don't want it to stay closed until you
explicitly reopen it?    Finally, if you put a window in front of it,
are you sure you want it to pop to the front automatically?  That might
get annoying.


-Lex



More information about the Squeak-dev mailing list