Equivalent of addSubView:in: in Squeak

Tim Olson tim at jumpnet.com
Mon Apr 27 13:21:24 UTC 1998


>however, the following code, which should display a transparent View
>containing two subviews in it, a gray subview which a black border, and a
>black subview with a gray border, does not work properly:
>
>"Example code in Philippe Dugerdil's Smalltalk-80, Programmation par Objets,
>Presses Polytechniques et Universitaires Romandes, 1990"
>| v v1 v2 |
>v := View new.
>v1 := View new.
>v2 := View new.
>v borderWidth: 1.
>v1 insideColor: Color gray.
>v2 insideColor: Color black.
>v window: v window viewport: (300 at 250 corner: 400 at 300).
>v addSubView: v1 in: (0 at 0 extent: 0.5 at 0.5) borderWidth: 2.
>v addSubView: v1 in: (0.5 at 0.5 extent: 1 at 1) borderWidth: 2.
               ^^                      ^^^

You are using v1 here when you mean v2, and the extent you want is 
probably 0.5 at 0.5, not 1 at 1.




     -- tim





More information about the Squeak-dev mailing list