G'day all, In the following code, I'm programmatically adding the contents of ImageImports to a Rectangle morph... the results aren't at all what I expect... the created IconicButtons are laid out in a nice 4x3 grid, but they extend outside the bounds of the Morph they are being added to, and their bounds are increasing as they are added...
any ideas?
Brian
initialize | leftFrame leftTop leftBottom rightFrame startx starty endx endy | window _ RectangleMorph newBounds: ((0@460) extent: (640@480)). window color: Color blue. window layoutPolicy: ProportionalLayout new. leftTop _ RectangleMorph new color: Color green. leftTop layoutPolicy: TableLayout new. leftTop addMorph: (SimpleButtonMorph new initializeWithLabel: 'Test Button'). leftBottom _ RectangleMorph new color: Color red. rightFrame _ RectangleMorph new color: Color yellow. rightFrame layoutPolicy: ProportionalLayout new. startx := 0. starty := 0. endx := 0.25. endy := 0.33. ImageImports keysAndValuesDo: [:key :val | (endy >= 1.0) ifFalse: [ rightFrame addMorph: (IconicButton new initializeToShow: (SketchMorph new initializeWith: val) withLabel: key andSend: #confirm to: self) fullFrame: (LayoutFrame fractions: (startx@starty extent: endx@endy)) ]. startx := startx + 0.25. endx := endx + 0.25. (startx > 0.75) ifTrue: [ startx := 0. endx := 0.25. starty := starty + 0.33. endy := endy + 0.33]. ]. rightFrame layoutChanged. window addMorph: leftTop fullFrame: (LayoutFrame fractions: (0@0 extent: 0.5@0.5)). window addMorph: leftBottom fullFrame: (LayoutFrame fractions: (0@0.5 extent: 0.5@0.5)). window addMorph: rightFrame fullFrame: (LayoutFrame fractions: (0.5@0 extent: 0.5@1)).
Brian Brown wrote:
G'day all, In the following code, I'm programmatically adding the contents of ImageImports to a Rectangle morph... the results aren't at all what I expect... the created IconicButtons are laid out in a nice 4x3 grid, but they extend outside the bounds of the Morph they are being added to, and their bounds are increasing as they are added...
fullFrame: (LayoutFrame fractions: (startx@starty extent: endx@endy)) ]. startx := startx + 0.25. endx := endx + 0.25. (startx > 0.75) ifTrue: [ startx := 0. endx := 0.25. starty := starty + 0.33.
I think you mean (startx@starty extent: 0.25@0.33)
On Friday 30 May 2003 05:15 pm, Ned Konz wrote:
I think you mean (startx@starty extent: 0.25@0.33)
Yes, that works flawlessly. So if I understand correctly, I'm simply specifying that the layout frame starts at a specific x@y and that the extent: of that particular layout frame will be 25% of the width (x direction) of the containing morph, and 33% of the height (y direction)?
Thank you Ned!
Brian
On Tuesday 03 June 2003 08:33 am, Brian Brown wrote:
On Friday 30 May 2003 05:15 pm, Ned Konz wrote:
I think you mean (startx@starty extent: 0.25@0.33)
Yes, that works flawlessly. So if I understand correctly, I'm simply specifying that the layout frame starts at a specific x@y and that the extent: of that particular layout frame will be 25% of the width (x direction) of the containing morph, and 33% of the height (y direction)?
Yes, except that of course the x@y is also relative to the parent Morph, and is a proportion rather than in pixels.
squeak-dev@lists.squeakfoundation.org