--- On Thu, 5/7/09, Edgar J. De Cleene <edgardec2...@yahoo.com.ar> wrote:
> From: Edgar J. De Cleene <edgardec2...@yahoo.com.ar>
> Subject: [Newbies] [Q] What is wrong here ?
> To: "A friendly place to get answers to even the most basic questions about
> Squeak." <beginners@lists.squeakfoundation.org>
> Date: Thursday, May 7, 2009, 9:23 AM
> Folks:
> I try to made aq very simple MahJongg with this info links
> http://en.wikipedia.org/wiki/Mahjong_solitaire
> http://home.halden.net/vkp/vkp/
>
> For made the grid I made
>
> grid := OrderedCollection new.
>
> madeThisRowFor: aInteger at: aPoint
> | topRow square newSquare |
> topRow := AlignmentMorph newRow.
> topRow position: aPoint.
> topRow openInWorld.
> square := Morph new.
> square color: Color transparent;
> borderWidth: 2;
> extent: 45 @ 54;
> borderColor: Color blue.
> 1
> to: aInteger
> do: [:c |
> newSquare := square copy.
> topRow addMorph: newSquare.
> grid add: topRow submorphs last center].
>
>
> DonĀ¹t work as grid is populated by same values .
> Example:
> self madeThisRowFor: 12 at: 0 @ 0.
>
> Grid an OrderedCollection(2...@27 2...@27 2...@27 2...@27 2...@27
> 2...@27 2...@27 2...@27
> 2...@27 2...@27 2...@27 2...@27)
>
> But if I put self half before
>
> grid add: topRow submorphs last center
>
> I got
>
> an OrderedCollection(2...@29 6...@29 1...@29 etc )
>
> Really odd, some could explain ?
You have left out some important details.
There seems to be a class involved.
What is it. Is grid an ivar of that class?
====
Also, Why not do a mockup in a workspace first?
Why not just create the row then collect the centers from the submorphs?
e.g.
squarePrototype := what you said for square.
topRow := what you said for topRow
anInteger timesDo: [ topRow addMorph: squarePrototype copy ] .
then make
grid := topRow submorphs collect: [ :each | each center ] .
Yours in curiosity and service, -Jerome Peace
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners