Alignment in the post AlignmentMorph era

Bob Arning arning at charm.net
Mon Apr 23 17:43:05 UTC 2001


Andrew,

Add

	self hResizing: #shrinkWrap.
	self vResizing: #shrinkWrap.

to LauncherMorph>>initialize

Remove

	self layoutChanged

from LauncherMorph>>initialize since it is unnecessary here. (You are still in initialization - the morph knows it has to lay things out)

The method LauncherMorph>>layoutChanged is not needed. Remove it.

The methods #beVertical and #beHorizontal are not strictly needed. You can change these plus many other things from the menu on the red handle (or the control-click menu) without needing to write a doIt.

My personal preference is to minimize repetitive code, so

	button _ LaunchButtonMorph new label: 'Browser';
				 target: Browser;
				 actionSelector: #openBrowser;
				 actWhen: #buttonUp.
	self addMorph: button.

could become

	self addAButton: 'Browser' target: Browser actionSelector: #openBrowser.

or even

	self addAButton: {'Browser' . Browser . #openBrowser}.

with the addition of one method to LauncherMorph. YMMV.

Cheers,
Bob


On Mon, 23 Apr 2001 08:51:40 -0700 "Andrew P. Black" <apb at cse.ogi.edu> wrote:
>I spent a long time looking for a method with "shrinkWrap" or 
>something similar in its name.  "self rubberBandCells: true" was an 
>epiphany! I think that my problem is in the what the Launcher does to 
>recompute its bounds in response to #layoutChanged.  I tried a bunch 
>of things, including bounds := nil (good guess to force 
>recomputation, don't you think, but it actually caused a walkback). 
>What I have now is:
>
>!LauncherMorph methodsFor: 'layout' stamp: 'apb 4/23/2001 01:13'!
>layoutChanged
>	super layoutChanged.
>	bounds _ (bounds origin corner: bounds origin).
>	bounds _ self fullBounds! !
>
>I think that bounds needs to be set to the fullBounds for the 
>submorphs plus the  borderWidth plus the layoutInset.  But there is 
>surely already logic in Morph to set this correctly --- the question 
>is, how should I trigger it?





More information about the Squeak-dev mailing list