ShowMeHowItWorks.st
changeset 3713 fa10e87dbf04
parent 3711 a472042fd298
child 3714 d3314ff81424
equal deleted inserted replaced
3712:688f4186d4f2 3713:fa10e87dbf04
     3 "{ Package: 'stx:libtool2' }"
     3 "{ Package: 'stx:libtool2' }"
     4 
     4 
     5 "{ NameSpace: Smalltalk }"
     5 "{ NameSpace: Smalltalk }"
     6 
     6 
     7 Object subclass:#ShowMeHowItWorks
     7 Object subclass:#ShowMeHowItWorks
     8 	instanceVariableNames:'opStream lastComponentName lastComponent lastResult'
     8 	instanceVariableNames:'application opStream lastComponentName lastComponent lastResult'
     9 	classVariableNames:''
     9 	classVariableNames:''
    10 	poolDictionaries:''
    10 	poolDictionaries:''
    11 	category:'Interface-Help'
    11 	category:'Interface-Help'
    12 !
    12 !
    13 
    13 
    14 !ShowMeHowItWorks class methodsFor:'documentation'!
    14 !ShowMeHowItWorks class methodsFor:'documentation'!
    15 
    15 
    16 documentation
    16 documentation
    17 "
    17 "
    18     documentation to be added.
    18     automatic presentations.
    19 
    19     To see how it works, open a methodFinder:
    20     class:
    20         MethodFinderWindow open
    21         <a short class summary here, describing what instances represent>
    21     and select its 'Show me how it works' item in the help menu.
    22 
       
    23     responsibilities:    
       
    24         <describing what my main role is>
       
    25 
       
    26     collaborators:    
       
    27         <describing with whom and how I talk to>
       
    28 
       
    29     API:
       
    30         <public api and main messages>
       
    31         
       
    32     example:
       
    33         <a one-line examples on how to use - can also be in a separate example method>
       
    34 
       
    35     implementation:
       
    36         <implementation points>
       
    37 
    22 
    38     [author:]
    23     [author:]
    39         Claus Gittinger
    24         Claus Gittinger
    40 
       
    41     [instance variables:]
       
    42 
       
    43     [class variables:]
       
    44 
       
    45     [see also:]
       
    46 
       
    47 "
    25 "
    48 !
    26 !
    49 
    27 
    50 example
    28 example
       
    29     MethodFinderWindow open.
       
    30     
    51     ShowMeHowItWorks do:#(
    31     ShowMeHowItWorks do:#(
    52         ( showing: 'Choose the number of arguments' do:(
    32         ( showing: 'Choose the number of arguments' do:(
    53             moveTo: NumberOfArguments
    33             moveTo: NumberOfArguments
    54             select: '1' 
    34             select: '1' 
    55         ))  
    35         ))  
    82 
    62 
    83 doStream:specStream
    63 doStream:specStream
    84     "must run as a separate process;
    64     "must run as a separate process;
    85      otherwise - if started by the app itself -
    65      otherwise - if started by the app itself -
    86      no events will be processed while running"
    66      no events will be processed while running"
    87      
    67 
       
    68     |appWhichStartedMe|
       
    69     
       
    70     appWhichStartedMe := WindowGroup activeMainApplication.
       
    71     
    88     [
    72     [
    89         self new doStream:specStream
    73         self new 
       
    74             application:appWhichStartedMe;
       
    75             doStream:specStream
    90     ] fork.
    76     ] fork.
    91 
    77 
    92     "Created: / 19-07-2019 / 10:53:07 / Claus Gittinger"
    78     "Created: / 19-07-2019 / 10:53:07 / Claus Gittinger"
    93     "Modified (comment): / 19-07-2019 / 14:30:29 / Claus Gittinger"
    79     "Modified: / 19-07-2019 / 16:44:02 / Claus Gittinger"
       
    80 ! !
       
    81 
       
    82 !ShowMeHowItWorks methodsFor:'accessing'!
       
    83 
       
    84 application:something
       
    85     application := something.
    94 ! !
    86 ! !
    95 
    87 
    96 !ShowMeHowItWorks methodsFor:'commands'!
    88 !ShowMeHowItWorks methodsFor:'commands'!
    97 
    89 
    98 intro
    90 intro
   438 !
   430 !
   439 
   431 
   440 findComponent:componentName
   432 findComponent:componentName
   441     "find a component by name - in the active and possibly in any app"
   433     "find a component by name - in the active and possibly in any app"
   442     
   434     
   443     |app component candidates|
   435     |component candidates|
   444 
   436 
   445     app := WindowGroup activeMainApplication.
   437     application notNil ifTrue:[ 
   446     app notNil ifTrue:[ 
   438         component := self findComponent:componentName in:application.
   447         component := self findComponent:componentName in:app.
       
   448     ].
   439     ].
   449     
   440     
   450     component isNil ifTrue:[
   441     component isNil ifTrue:[
   451         "/ search through all current applications
   442         "/ search through all current applications
   452         candidates := OrderedCollection new.
   443         candidates := OrderedCollection new.
   470         ].    
   461         ].    
   471     ].    
   462     ].    
   472     ^ component
   463     ^ component
   473 
   464 
   474     "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
   465     "Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
       
   466     "Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
   475 !
   467 !
   476 
   468 
   477 findComponent:componentName in:anApplication
   469 findComponent:componentName in:anApplication
   478     |component componentNameSymbol foundByName foundByTitle foundByLabel|
   470     |component componentNameSymbol foundByName foundByTitle foundByLabel|
   479 
   471