help needed setting the initial size of a SystemWindow instance
Raab, Andreas
Andreas.Raab at disney.com
Sat May 12 06:33:49 UTC 2001
Hi Greg,
> I've finally found the time to re-familiarise myself with Smalltalk
> after a very long hiatus, and I'm using Squeak of course!
Heh, heh. Welcome back!
> 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.
[lot's of stuff deleted]
> 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.
Correct. Have a look at SystemWindow>>openInWorld: which assigns new bounds
right before putting the window up in the world. One way of changing this
behavior would be to implement
SystemWindow>>openAsIsIn: aWorld
"Open the receiver with its existing bounds in the given world"
aWorld addMorph: self.
self activate.
aWorld startSteppingSubmorphsOf: self.
and - if you're as lazy as I am - implement
SystemWindow>>openAsIs
^self openAsIsIn: self currentWorld.
[Hm ... this method should really be in there - I'll post an update later]
> 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! :-)
Dude - why don't you just copy that method from SystemWindow over to
FITBM???? That's easy too (or is it too easy?! ;-)
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|