[Newbies] [Q] What is wrong here ?

Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Thu May 7 13:23:15 UTC 2009


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(22 at 27 22 at 27 22 at 27 22 at 27 22 at 27 22 at 27 22 at 27 22 at 27
22 at 27 22 at 27 22 at 27 22 at 27)

But if I put self half before

grid add: topRow submorphs last center

I got

an OrderedCollection(24 at 29 69 at 29 114 at 29 etc )

Really odd, some could explain ?

Edgar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20090507/c21b2222/attachment.htm


More information about the Beginners mailing list