What is the equivalent of:
v := View new. ..... v window: v window viewport: (300@250 corner: 400@300).
"This is the problematic line" v addSubView: v1 in: (0@0 extent: 0.5@0.5) borderWidth: 2.
in Squeak Smalltalk? addSubView:in: does not seem to exist in Squeak.
Another question: why "v window: v window"? If v is a View, why do you need to tell it that its window is its own (v's) window?
Many thanks.
Philippe de Rochambeau
Philippe,
I have been working on this problem as well.
This command
v addSubView: v1 in: (0@0 extent: 0.5@0.5) borderWidth: 2
is supposed to open the subView v1 in a window/view/??? that is one half of the width View v and oneself the height of of View v. It is supposed to make all of the sub-views dynamically scaleable.
I am reading about all this in "Inside Smalltalk". I am trying to understand the relationship between window/view/display and I can tell you what it says in the book but I have not internalized the rule in a way that I can used it easily.
I have looked and looked and could not find an equivalent method in Squeak.
I will let you know if I find out anything this weekend. (Unless one of our helpful gurus answers first.)
Regards,
John-Reed Maffeo
pr1@club-internet.fr%INTERNET wrote:
What is the equivalent of:
v := View new. .... v window: v window viewport: (300@250 corner: 400@300).
"This is the problematic line" v addSubView: v1 in: (0@0 extent: 0.5@0.5) borderWidth: 2.
in Squeak Smalltalk? addSubView:in: does not seem to exist in Squeak.
Another question: why "v window: v window"? If v is a View, why do you need to tell it that its window is its own (v's) window?
Many thanks.
Philippe de Rochambeau
John-Reed Maffeo (rlpa80) wrote:
Philippe,
I have been working on this problem as well.
This command
v addSubView: v1 in: (0@0 extent: 0.5@0.5) borderWidth: 2
is supposed to open the subView v1 in a window/view/??? that is one half of the width View v and oneself the height of of View v. It is supposed to make all of the sub-views dynamically scaleable.
I am reading about all this in "Inside Smalltalk". I am trying to understand the relationship between window/view/display and I can tell you what it says in the book but I have not internalized the rule in a way that I can used it easily.
I have looked and looked and could not find an equivalent method in Squeak.
I will let you know if I find out anything this weekend. (Unless one of our helpful gurus answers first.)
Regards,
John-Reed Maffeo
John-Reed,
Sam Adams sent me the following code which is somewhat helpful:
========= Message begins ================= Subject: Re: Equivalent of addSubView:in: in Squeak Date: Fri, 24 Apr 1998 14:48:16 -0400 From: Sam Adams ssadams@us.ibm.com To: pr1@club-internet.fr
Add this method to View.
addSubView: aView in: aRelativeRectangle borderWidth: width "11/3/96 ssa - added for compatibility."
"Make 'aView' into a subview. Use 'aRelativeRectangle' and the super view's window to compute (1) a viewport within the superview for 'aView' and (2) the window extent for 'aView'. Note: defining the windowing transformation and deriving the viewport is logically equivalent but does not seem to be easily done"
| subViewPort myWindow myExtent myOrigin | self addSubView: aView ifCyclic: [self error: 'cycle in subView structure.']. aView borderWidth: width. myWindow _ self window. myExtent _ myWindow extent. myOrigin _ myWindow origin. subViewPort _ myExtent * aRelativeRectangle origin + myOrigin corner: myExtent * aRelativeRectangle corner + myOrigin. aView window: aView window viewport: subViewPort
Sam S. Adams, Distinguished Engineer, IBM Network Computing Software Division tie line 444-0736, outside 919-254-0736, email: ssadams@us.ibm.com <<Hebrews 11:6, Proverbs 3:5-6, Romans 1:16-17, I Corinthians 1:10>>
========= Message ends=============
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@250 corner: 400@300). v addSubView: v1 in: (0@0 extent: 0.5@0.5) borderWidth: 2. v addSubView: v1 in: (0.5@0.5 extent: 1@1) borderWidth: 2. v display
.... I am trying to figure out why.
Philippe de Rochambeau
squeak-dev@lists.squeakfoundation.org