#TUNING by cg
authorClaus Gittinger <cg@exept.de>
Tue, 18 Jul 2017 15:31:23 +0200
changeset 6185 11a10868443b
parent 6184 5c47cff0a192
child 6186 f0026b792a12
#TUNING by cg class: SelectionInListView added: #flyByHelpTextForLine: changed: #flyByHelpTextAt:
SelectionInListView.st
--- a/SelectionInListView.st	Tue Jul 18 12:32:38 2017 +0200
+++ b/SelectionInListView.st	Tue Jul 18 15:31:23 2017 +0200
@@ -2821,16 +2821,43 @@
 !SelectionInListView methodsFor:'help'!
 
 flyByHelpTextAt:aPoint
-    |lineNr len|
+    "ask the line for its help text"
+     
+    |lineNr|
 
     lineNr := self lineAtY:aPoint y.
     lineNr notNil ifTrue:[
-        len := self widthOfLine:lineNr.
-        len > width ifTrue:[
-            ^ (self listAt:lineNr) string collect:[:ch | ch isSeparator ifTrue:[$ ] ifFalse:[ch]]  
-        ].      
+        ^ self flyByHelpTextForLine:lineNr
     ].
     ^ nil
+
+    "Modified (comment): / 18-07-2017 / 13:32:04 / cg"
+!
+
+flyByHelpTextForLine:lineNr
+    "the fallback here is to ask the item if it is not a string,
+     otherwise, return the full label string
+     for lines which are clipped (longer than the view's width)"
+     
+    |item len text|
+
+    item := self at:lineNr.
+    item isString ifFalse:[
+        text := item perform:#flyByHelpText ifNotUnderstood:nil.
+        text notNil ifTrue:[
+            ^ text
+        ].    
+    ].
+    
+    len := self widthOfLine:lineNr.
+    len > width ifTrue:[
+        ^ (self listAt:lineNr) string 
+            replaceAllForWhich:#isSeparator with:(Character space)
+            "/    collect:[:ch | ch isSeparator ifTrue:[$ ] ifFalse:[ch]]  
+    ].      
+    ^ nil
+
+    "Created: / 18-07-2017 / 13:31:36 / cg"
 ! !
 
 !SelectionInListView methodsFor:'initialization'!