#FEATURE by exept draft
authorClaus Gittinger <cg@exept.de>
Thu, 14 Nov 2019 12:10:56 +0100
changeset 3818 c3fd02d2d975
parent 3817 34cfc2fb2258
child 3819 a2f591cb8405
#FEATURE by exept class: ShowMeHowItWorks added: #scrollToEnd changed: #doStream:from: #possiblyTranslate:
ShowMeHowItWorks.st
--- a/ShowMeHowItWorks.st	Tue Nov 12 13:38:57 2019 +0100
+++ b/ShowMeHowItWorks.st	Thu Nov 14 12:10:56 2019 +0100
@@ -913,6 +913,27 @@
     "Modified: / 23-07-2019 / 09:38:38 / Claus Gittinger"
 !
 
+scrollToEnd
+    <action>
+
+    |scrollWrapper|
+
+    "/ look for a scrollable view along the superview hierarchy
+    scrollWrapper := lastComponent 
+        allSuperViewsDetect:[:v | v isScrollWrapper]
+        ifNone:nil.
+
+    scrollWrapper isNil ifTrue:[
+        "/ look in subviews for the first scrollWrapper
+        scrollWrapper := lastComponent 
+            allSubViewsDetect:[:v | v shown and:[v isScrollWrapper]]
+            ifNone:nil.
+    ].
+    scrollWrapper notNil ifTrue:[
+        scrollWrapper scrollBar scrollToEnd
+    ].
+!
+
 select:itemsIndexOrLabelOrPattern
     "select an item by label,
      allowed after moving to:
@@ -2376,13 +2397,13 @@
 
             Display shiftDown ifTrue:[
                 (IntroShownCount ? 0) > 3 ifFalse:[
-                    self tell:(self possiblyTranslate:'You pressed the SHIFT key.').
+                    self tell:(self class classResources string:'You pressed the SHIFT key.').
                 ].    
-                self tell:(self possiblyTranslate:'Do you want to stop the show?').
+                self tell:(self class classResources string:'Do you want to stop the show?').
                 (Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
                 ifTrue:[
                     self tell:(self possiblyTranslate:'OK,').
-                    self tell:(self possiblyTranslate:(self randomThankYou)).
+                    self tell:(self class classResources string:(self randomThankYou)).
                     ^ AbortOperationRequest raise
                 ].    
             ].    
@@ -2425,10 +2446,13 @@
 !
 
 possiblyTranslate:aString
-    translate ifTrue:[^ self class classResources string:aString].
+    |xLatedMessage|
+
+    translate ifTrue:[
+        xLatedMessage := self class classResources stringWithCRs:aString.
+        ^ xLatedMessage
+    ].
     ^ aString
-
-    "Created: / 23-07-2019 / 11:48:17 / Claus Gittinger"
 ! !
 
 !ShowMeHowItWorks::ItemInView class methodsFor:'documentation'!