help needed setting the initial size of a SystemWindow instance

Greg A. Woods woods at weird.com
Sat May 12 06:10:28 UTC 2001


I've finally found the time to re-familiarise myself with Smalltalk
after a very long hiatus, and I'm using Squeak of course!

Morphic however has taken me for a bit of a loop!  But it is very cool!

I'm slowly beginning to have some success at modifying and enhancing the
various IRC-Chat classes.  However the one particular task mentioned in
my subject line has left me completely at a loss.

I'd like one of my new dialogue boxes to pop up in a nice small window,
and either near where the cursor is now, or else in the center of the
screen.  The FillInTheBlankMorph seems to do this, but I can't seem to
imitate it using SystemWindow.  (My new method is derrived mostly from
IRCConnection's openConnectionDialogue method.)  The SystemWindow
instance I'm creating is made up of a number of rows of TextFieldMorph
and PluggableTextMorph, as well as some PluggableButtonMorphs.  I place
all these parts into the main window using addMorph:frame: and that part
all seems to work just fine.

As for controlling its initial size, well the best I've been able to
manage so far is to resize it after it has already opened in whatever
happens to be the default place with the default window size (i.e. after
sending it an openInWorld message).  I do this by simply sending it an
extent: message.  Unfortunately sending an extent: message at any other
time during the creation of the morph (i.e. before, after, or in the
middle of sending the addMorph:frame: messages) doesn't seem to have
any effect at all.

I tried telling it that it should openCenteredInWorld too, but that
doesn't seem to change where it opens initially either.

One major difference I see with the FillInTheBlankMorph class (eg. in
the setQuery:initialAnswer:answerHeight:acceptOnCR: method) is that it
makes use of layoutFrame: to pass an instance of a LayoutFrame to each
submorph and then just uses addMorph: to add them to the enclosing morph
instead of using addMorph:frame: as I'm doing. I haven't tried doing
this in my example yet because I haven't yet wrapped my mind around the
use of LayoutFrame.  Hopefully that's not the crictical difference
though because addMorph:frame: is soooo much simpler!  :-)

If anyone has any clues to offer, or questions to clarify, please do let
me know!  Thanks!

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods at acm.org>     <woods at robohack.ca>
Planix, Inc. <woods at planix.com>;   Secrets of the Weird <woods at weird.com>





More information about the Squeak-dev mailing list