VariableHorizontalPanel.st
changeset 496 f22ac16a5093
parent 294 667773990289
child 585 8f395aba0173
--- a/VariableHorizontalPanel.st	Thu Mar 07 19:49:31 1996 +0100
+++ b/VariableHorizontalPanel.st	Fri Mar 08 11:53:23 1996 +0100
@@ -11,10 +11,10 @@
 "
 
 VariablePanel subclass:#VariableHorizontalPanel
-	 instanceVariableNames:''
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Layout'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Layout'
 !
 
 !VariableHorizontalPanel class methodsFor:'documentation'!
@@ -48,57 +48,160 @@
     The subvies dimensions MUST be given as relative sizes;
     typically creation is done as:
 
-	p := VariableHorizontalPanel in:superView.
-	v1 := <someViewClass> origin:0.0 @ 0.0
-			      corner:0.5 @ 1.0
-				  in:p.
-	v2 := <someViewClass> origin:0.5 @ 0.0
-			      corner:0.8 @ 1.0
-				  in:p.
-	v3 := <someViewClass> origin:0.8 @ 0.0
-			      corner:1.0 @ 1.0
-				  in:p.
+        p := VariableHorizontalPanel in:superView.
+        v1 := <someViewClass> origin:0.0 @ 0.0
+                              corner:0.5 @ 1.0
+                                  in:p.
+        v2 := <someViewClass> origin:0.5 @ 0.0
+                              corner:0.8 @ 1.0
+                                  in:p.
+        v3 := <someViewClass> origin:0.8 @ 0.0
+                              corner:1.0 @ 1.0
+                                  in:p.
+
+    See examples.
 "
 !
 
 examples
 "
-   example:
-	|top p v1 v2 v3|
+   dummy example: 2 views side-by-side
+
+        |top p v1 v2|
+
+        top := StandardSystemView new.
+        top extent:300@200.
+
+        p := VariableHorizontalPanel 
+                 origin:0.0 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:top.
+
+        v1 := View 
+                 origin:0.0 @ 0.0
+                 corner:0.5 @ 1.0
+                 in:p.
+        v1 viewBackground:Color red.
+
+        v2 := View 
+                 origin:0.5 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:p.
+        v2 viewBackground:Color green.
+
+        top open
+
+
+
+   concrete example: a selectionInListView and a TextView side-by-side
+   (not useful - need scrollBars; see next example)
 
-	top := StandardSystemView new.
-	top extent:300@200.
+        |top p v1 v2|
+
+        top := StandardSystemView new.
+        top extent:400@300.
+
+        p := VariableHorizontalPanel 
+                 origin:0.0 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:top.
+
+        v1 := SelectionInListView 
+                 origin:0.0 @ 0.0
+                 corner:0.5 @ 1.0
+                 in:p.
+        v1 list:('/etc' asFilename directoryContents).
+        v1 useIndex:false.
+        v1 action:[:name | v2 contents:('/etc/' , name) 
+                                asFilename contentsOfEntireFile
+                  ].
+
+        v2 := TextView 
+                 origin:0.5 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:p.
+
+        top open
+
+
+
+    better - with scrollBars (but thats another story ... see ScrollableView examples for more):
 
-	p := VariableHorizontalPanel 
-		 origin:0.0 @ 0.0
-		 corner:1.0 @ 1.0
-		 in:top.
-	v1 := SelectionInListView 
-		 origin:0.0 @ 0.0
-		 corner:0.5 @ 1.0
-		 in:p.
-	v2 := EditTextView 
-		 origin:0.5 @ 0.0
-		 corner:0.8 @ 1.0
-		 in:p.
-	v3 := ScrollableView 
-		 for:TextView 
-		 in:p.
-	v3 origin:0.8 @ 0.0 
-	   corner:1.0 @ 1.0.
-	top open
+        |top p v1 v2|
+
+        top := StandardSystemView new.
+        top extent:400@300.
+
+        p := VariableHorizontalPanel 
+                 origin:0.0 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:top.
+
+        v1 := ScrollableView for:SelectionInListView 
+                 origin:0.0 @ 0.0
+                 corner:0.5 @ 1.0
+                 in:p.
+        v1 list:('/etc' asFilename directoryContents).
+        v1 useIndex:false.
+        v1 action:[:name | v2 contents:('/etc/' , name) 
+                                asFilename contentsOfEntireFile
+                  ].
+
+        v2 := ScrollableView for:TextView 
+                 origin:0.5 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:p.
+
+        top open
+
+
+
+   another stupid example: 3-views side-by-side
+
+        |top p v1 v2 v3|
+
+        top := StandardSystemView new.
+        top extent:550@200.
+
+        p := VariableHorizontalPanel 
+                 origin:0.0 @ 0.0
+                 corner:1.0 @ 1.0
+                 in:top.
+
+        v1 := SelectionInListView 
+                 origin:0.0 @ 0.0
+                 corner:0.3 @ 1.0
+                 in:p.
+        v1 level:-1.
+        v1 list:#('one' 'two' 'three' nil 'dont expect' 'something' 'to happen here').
+
+        v2 := EditTextView 
+                 origin:0.3 @ 0.0
+                 corner:0.6 @ 1.0
+                 in:p.
+        v2 contents:'nonScrollable\EditTextView' withCRs.
+
+        v3 := ScrollableView 
+                 for:TextView 
+                 origin:0.6 @ 0.0 
+                 corner:1.0 @ 1.0
+                 in:p.
+        v3 contents:'scrollable\TextView\\(read only)\\\\\\\\\\\\\\\\\concratulations !!\you managed\to scroll down' withCRs.
+        top open
 "
 ! !
 
 !VariableHorizontalPanel methodsFor:'initializing'!
 
 initialize
+    orientation := #horizontal.
     super initialize.
-    orientation := #horizontal
+
+    "Modified: 7.3.1996 / 14:08:35 / cg"
 ! !
 
 !VariableHorizontalPanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.18 1996-01-18 00:09:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/VariableHorizontalPanel.st,v 1.19 1996-03-08 10:53:23 cg Exp $'
 ! !