fixed #widthOfContents if no device is known
authorClaus Gittinger <cg@exept.de>
Tue, 30 Apr 1996 17:36:22 +0200
changeset 607 67462978fb20
parent 606 682579fa3b62
child 608 aedd7bf72edc
fixed #widthOfContents if no device is known
ListView.st
--- a/ListView.st	Tue Apr 30 17:35:14 1996 +0200
+++ b/ListView.st	Tue Apr 30 17:36:22 1996 +0200
@@ -1943,40 +1943,48 @@
     "return the width of the contents in pixels
      - used for scrollbar interface"
 
-    |max|
+    |max f|
 
     list isNil ifTrue:[^ 0].
     widthOfWidestLine notNil ifTrue:[^ widthOfWidestLine + (leftMargin * 2)].
-    font := font on:device.
+
+    device isNil ifTrue:[
+        "/ mhmh - really dont know yet
+        f := font on:Display
+    ] ifFalse:[
+        f := font := font on:device.
+    ].
 
     includesNonStrings ifTrue:[
-	max := list 
-		   inject:0 
-		   into:[:maxSoFar :entry |
-			     (
-				 entry isNil ifTrue:[
-				     0
-				 ] ifFalse:[
-				    entry isString ifTrue:[
-					font widthOf:entry
-				    ] ifFalse:[
-					entry widthIn:self
-				    ]
-				 ]
-			     ) max:maxSoFar.
-			]
+        max := list 
+                   inject:0 
+                   into:[:maxSoFar :entry |
+                             (
+                                 entry isNil ifTrue:[
+                                     0
+                                 ] ifFalse:[
+                                    entry isString ifTrue:[
+                                        f widthOf:entry
+                                    ] ifFalse:[
+                                        entry widthIn:self
+                                    ]
+                                 ]
+                             ) max:maxSoFar.
+                        ]
     ] ifFalse:[
-	fontIsFixedWidth ifTrue:[
-	    max := self lengthOfLongestLine * fontWidth
-	] ifFalse:[
-	    max := 0.
-	    list notNil ifTrue:[
-		max := max max:(font widthOf:list)
-	    ].
-	].
+        fontIsFixedWidth ifTrue:[
+            max := self lengthOfLongestLine * fontWidth
+        ] ifFalse:[
+            max := 0.
+            list notNil ifTrue:[
+                max := max max:(f widthOf:list)
+            ].
+        ].
     ].
     widthOfWidestLine := max.
     ^ max + (leftMargin * 2)
+
+    "Modified: 30.4.1996 / 17:33:57 / cg"
 !
 
 xOriginOfContents
@@ -3082,5 +3090,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.80 1996-04-30 09:39:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.81 1996-04-30 15:36:22 cg Exp $'
 ! !