#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Tue, 23 Apr 2019 20:05:22 +0200
changeset 6042 65ee63cf658e
parent 6041 a8c62dc42ff2
child 6043 8d87fa82b05d
#BUGFIX by cg class: DataSetColumn changed: #drawLabelsAtX:y:h:from:to: care for multiline contents of a cell, which does not fit the height.
DataSetColumn.st
--- a/DataSetColumn.st	Wed Apr 03 09:47:54 2019 +0200
+++ b/DataSetColumn.st	Tue Apr 23 20:05:22 2019 +0200
@@ -615,8 +615,10 @@
 drawLabelsAtX:xLeft y:yTop h:h from:start to:stop
     "redraw labels from start to stop"
 
-    |fg y yT x hspace lblHg bg label row isSel cachedWidth lineColor|
+    |fg y yT x hspace lblHg bg label row isSel cachedWidth lineColor minTopMargin|
 
+    minTopMargin := 4.
+    
     cachedWidth := self width.
     cachedWidth isNil ifTrue:[ ^ self ].
 
@@ -684,7 +686,7 @@
             ] ifFalse:[
                 (isSel and:[dataSet hasOpenEditor]) ifTrue:[
                     label := nil
-                ]  ifFalse:[
+                ] ifFalse:[
                     label := self shownValueForRow:row rowNr:aRowNr
                 ]
             ].
@@ -699,7 +701,11 @@
                 lblHg := self heightOfLabel:label.
 
                 lblHg ~~ 0 ifTrue:[
-                    y := y + ((h - lblHg) // 2).
+                    lblHg < (h - minTopMargin) ifTrue:[
+                        y := y + ((h - lblHg) // 2).
+                    ] ifFalse:[
+                        y := y + minTopMargin.
+                    ].    
                     dataSet paint:fg on:bg.
 
                     (label isString and:[label includes:Character cr]) ifTrue:[
@@ -707,11 +713,22 @@
                     ].
 
                     (label isNonByteCollection) ifTrue:[
+                        |skipRest|
+                        
                         "a collection of labels"
+                        skipRest := false.
                         label do:[:el|
-                            el notNil ifTrue:[
-                                self drawLabel:el atX:x y:y.
-                                y := y + (el heightOn:dataSet).
+                            |yNext|
+                            
+                            (el notNil and:[skipRest not]) ifTrue:[
+                                yNext := y + (el heightOn:dataSet).
+                                yNext >= (h-minTopMargin) ifTrue:[
+                                    self drawLabel:'...' atX:x y:y-4.
+                                    skipRest := true.
+                                ] ifFalse:[    
+                                    self drawLabel:el atX:x y:y.
+                                    y := yNext.
+                                ]
                             ]
                         ]
                     ] ifFalse:[
@@ -725,6 +742,7 @@
     ]
 
     "Modified: / 20-01-2011 / 08:50:18 / cg"
+    "Modified: / 23-04-2019 / 20:04:00 / Claus Gittinger"
 !
 
 drawRendererInRow:rowNr x:xLeft y:y width:cellWidth value:cellValue