#DOCUMENTATION by exept draft
authorClaus Gittinger <cg@exept.de>
Mon, 14 Oct 2019 11:42:39 +0200
changeset 3783 e935b92253c9
parent 3782 f26ed65a4360
child 3784 f6654cc10071
#DOCUMENTATION by exept class: ShowMeHowItWorks class definition changed: #do: #doStream: #findComponent: #select:
ShowMeHowItWorks.st
--- a/ShowMeHowItWorks.st	Mon Oct 14 10:48:32 2019 +0200
+++ b/ShowMeHowItWorks.st	Mon Oct 14 11:42:39 2019 +0200
@@ -5,8 +5,9 @@
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#ShowMeHowItWorks
-	instanceVariableNames:'application opStream lastComponentName lastComponent lastResult
-		voice translate language verifying closeApplicationWhenFinished'
+	instanceVariableNames:'application opStream streamStack lastComponentName lastComponent
+		lastResult voice translate language verifying
+		closeApplicationWhenFinished defaultComponentWaitTime'
 	classVariableNames:'IntroShownCount DebugMode'
 	poolDictionaries:''
 	category:'Interface-Help'
@@ -433,25 +434,40 @@
 
     <action>
 
-    |idx|
+    |idx component|
 
     verifying ifTrue:[^ self].
 
-    (lastComponent isKindOf:ComboView) ifTrue:[
+    ((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
+        component := component scrolledView.
+    ].
+
+    (component isKindOf:ComboView) ifTrue:[
         "/ click on the menubutton
-        self movePointerToComponent:lastComponent menuButton.
-        self click:1 inComponent:lastComponent menuButton.
+        self movePointerToComponent:component menuButton.
+        self click:1 inComponent:component menuButton.
         Delay waitForSeconds:0.3.
-        (idx := lastComponent list indexOf:itemsLabel ifAbsent:[nil]) isNil ifTrue:[
+        (idx := component list indexOf:itemsLabel ifAbsent:[nil]) isNil ifTrue:[
             self error:'no such item in comboList: ',itemsLabel
         ].
-        lastComponent select:idx.
+        component select:idx.
         Delay waitForSeconds:0.3.
-        lastComponent shownMenu notNil ifTrue:[
-            lastComponent shownMenu hide.
+        component shownMenu notNil ifTrue:[
+            component shownMenu hide.
         ].    
         ^ self
     ].    
+    (component isKindOf:HierarchicalListView) ifTrue:[
+        component 
+            selectElementForWhich:[:el |
+                el label string = itemsLabel
+            ] 
+            ifAbsent:[
+                self error:'no such item in hierarchicalList: ',itemsLabel
+            ].
+        ^ self
+    ].
+
     self error:'cannot select this component'
 
     "Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
@@ -759,7 +775,7 @@
             ^ candidates first
         ].
     ].
-    application isNil ifTrue:[
+    true "application isNil" ifTrue:[
         "/ search through all current applications
         WindowGroup scheduledWindowGroups do:[:eachWG |
             |eachApp|
@@ -1212,6 +1228,7 @@
         application := WindowGroup activeMainApplication.
     ].
     closeApplicationWhenFinished := false.
+    defaultComponentWaitTime isNil ifTrue:[ defaultComponentWaitTime := 1 ].
 
     "/ run in verifying mode
     verifying := true.
@@ -1320,7 +1337,10 @@
     |previousStream resources|
 
     resources := self class classResources.
-    
+
+    streamStack isNil ifTrue:[ streamStack := OrderedCollection new ].
+    streamStack add:opStream.
+
     previousStream := opStream.
     [
         opStream := specStream.
@@ -1340,6 +1360,7 @@
             ].    
         ].    
     ] ensure:[
+        streamStack removeLast.
         opStream := previousStream
     ].