#DOCUMENTATION by cg draft
authorClaus Gittinger <cg@exept.de>
Fri, 19 Jul 2019 16:55:40 +0200
changeset 3713 fa10e87dbf04
parent 3712 688f4186d4f2
child 3714 d3314ff81424
#DOCUMENTATION by cg class: ShowMeHowItWorks class definition added: #application: changed: #findComponent: class: ShowMeHowItWorks class comment/format in: #documentation changed: #doStream: #example
ShowMeHowItWorks.st
--- a/ShowMeHowItWorks.st	Fri Jul 19 16:53:23 2019 +0200
+++ b/ShowMeHowItWorks.st	Fri Jul 19 16:55:40 2019 +0200
@@ -5,7 +5,7 @@
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#ShowMeHowItWorks
-	instanceVariableNames:'opStream lastComponentName lastComponent lastResult'
+	instanceVariableNames:'application opStream lastComponentName lastComponent lastResult'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Help'
@@ -15,39 +15,19 @@
 
 documentation
 "
-    documentation to be added.
-
-    class:
-        <a short class summary here, describing what instances represent>
-
-    responsibilities:    
-        <describing what my main role is>
-
-    collaborators:    
-        <describing with whom and how I talk to>
-
-    API:
-        <public api and main messages>
-        
-    example:
-        <a one-line examples on how to use - can also be in a separate example method>
-
-    implementation:
-        <implementation points>
+    automatic presentations.
+    To see how it works, open a methodFinder:
+        MethodFinderWindow open
+    and select its 'Show me how it works' item in the help menu.
 
     [author:]
         Claus Gittinger
-
-    [instance variables:]
-
-    [class variables:]
-
-    [see also:]
-
 "
 !
 
 example
+    MethodFinderWindow open.
+    
     ShowMeHowItWorks do:#(
         ( showing: 'Choose the number of arguments' do:(
             moveTo: NumberOfArguments
@@ -84,13 +64,25 @@
     "must run as a separate process;
      otherwise - if started by the app itself -
      no events will be processed while running"
-     
+
+    |appWhichStartedMe|
+    
+    appWhichStartedMe := WindowGroup activeMainApplication.
+    
     [
-        self new doStream:specStream
+        self new 
+            application:appWhichStartedMe;
+            doStream:specStream
     ] fork.
 
     "Created: / 19-07-2019 / 10:53:07 / Claus Gittinger"
-    "Modified (comment): / 19-07-2019 / 14:30:29 / Claus Gittinger"
+    "Modified: / 19-07-2019 / 16:44:02 / Claus Gittinger"
+! !
+
+!ShowMeHowItWorks methodsFor:'accessing'!
+
+application:something
+    application := something.
 ! !
 
 !ShowMeHowItWorks methodsFor:'commands'!
@@ -440,11 +432,10 @@
 findComponent:componentName
     "find a component by name - in the active and possibly in any app"
     
-    |app component candidates|
+    |component candidates|
 
-    app := WindowGroup activeMainApplication.
-    app notNil ifTrue:[ 
-        component := self findComponent:componentName in:app.
+    application notNil ifTrue:[ 
+        component := self findComponent:componentName in:application.
     ].
     
     component isNil ifTrue:[
@@ -472,6 +463,7 @@
     ^ component
 
     "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
+    "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
 !
 
 findComponent:componentName in:anApplication