[Newbies] Morphic buttons in Laser Game tutorial

ina tube innertube at doramail.com
Tue Sep 11 01:24:05 UTC 2007


>
>
> Hi,
>
> maybe I can help you find the problem.
>

Thanks!  I appreciate your help.

> > When I get to the part where tutorial describes creating the > 
> 'Fire' and 'Quit' buttons, though, I get an unexpected result.  > 
> The buttons are vastly oversized.
>
> What do you mean by oversized? Are they still contained in the control
> panel morph? A good way to check the embedding of morphs in containers
> is to bring up the Halo: first you get the halo of the outer morph,
> click again to get the halo of the next embedded morph etc. Another
> way is to give different morphs different colors. E.g.:
>
>     panel color: Color blue
>
> Can you send a screenshot of how these buttons look like?
> hope this helps


I'm attaching 2 screen captures of the oversized buttons.  I've 
changed the button colors, as you've suggested.  In the second 
screen capture, I've raised the halo.  The halo surrounds the Quit 
button.  The Fire button is covered by the Quit button, with only 
the top portion of the Fire button protruding.

As indicated in the tutorial, I use the following commands to attach the buttons.

	panel := RectangleMorph new
				borderWidth: 0;
				color: Color white;
				layoutPolicy: ProportionalLayout new.
	buttonHeight := 26.
	vertOffsetTop := 10 + buttonHeight + 10 + buttonHeight.
	vertOffsetBtm := 10 + buttonHeight + 10.
	panel
		addMorph: self makeFireLaserButton
		fullFrame: (LayoutFrame
			fractions: (0 at 0 corner: 1 at 1)
			offsets: (
				(20 @ (vertOffsetTop negated))
					corner: (-20 @ (vertOffsetBtm negated))
			)
		).
	vertOffsetTop := 10 + buttonHeight.
	vertOffsetBtm := 10.
	panel
		addMorph: self makeQuitGameButton
		fullFrame: (LayoutFrame
			fractions: (0 at 0 corner: 1 at 1)
			offsets: (
				(20 @ (vertOffsetTop negated))
					corner: (-20 @ (vertOffsetBtm negated))
			)
		).
	^panel

Thanks again,

Paul

-- 
_______________________________________________
Get your free email from http://mail.doramail.com

Powered by Outblaze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 1.png
Type: image/png
Size: 6830 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070911/d3bd3f51/Picture1-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture 2.png
Type: image/png
Size: 10918 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20070911/d3bd3f51/Picture2-0001.png


More information about the Beginners mailing list