[Newbies] Morphic buttons in Laser Game tutorial

Matthias Berth matthias.berth at googlemail.com
Mon Sep 10 19:44:22 UTC 2007


Hi,

maybe I can help you find the problem.

> 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.  I've checked the code and the tutorial several times, so I don't think I've typed in any erroneous code.

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?

> I've also browsed the PluggableButtonMorph class to see if I could remedy the problem by finding out which methods to call to re-size the buttons into something that approximates what the tutorial describes.  Yet I have not been able to do so.

The size of the buttons is controlled by the control panel morph that
contains them. Look in makeControlPanelMorph, it sets a LayoutPolicy
in the beginning. Then the buttons are added using
addMorph:fullFrame:.

hope this helps

Matthias


More information about the Beginners mailing list