I've been working through Stephen Wessel's fantastic Laser Game tutorial, and have enjoyed the process a great deal. I've gotten to the part where the tutorial describes using Morphic to create the UI for the game.
http://squeak.preeminent.org/tut2007/html/068.html
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.
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.
Can someone help me out with this section of the tutorial?
Thanks,
Paul
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
beginners@lists.squeakfoundation.org