ShowMeHowItWorks.st
changeset 3792 7682b28c1e92
parent 3791 471326a17840
child 3793 4759769ba7a3
equal deleted inserted replaced
3791:471326a17840 3792:7682b28c1e92
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "{ Package: 'stx:libtool2' }"
     3 "{ Package: 'stx:libtool2' }"
     2 
     4 
     3 "{ NameSpace: Smalltalk }"
     5 "{ NameSpace: Smalltalk }"
     4 
     6 
     5 Object subclass:#ShowMeHowItWorks
     7 Object subclass:#ShowMeHowItWorks
    62 
    64 
    63     "
    65     "
    64      ShowMeHowItWorks do:
    66      ShowMeHowItWorks do:
    65         #(
    67         #(
    66             (language: de)
    68             (language: de)
    67             (show: 'üben üben üben')
    69             (show: 'üben üben üben')
    68             (wait: 0.5)
    70             (wait: 0.5)
    69             (moveTo: NameOfComponent)
    71             (moveTo: NameOfComponent)
    70         )    
    72         )    
    71     "
    73     "
    72 
    74 
    81 
    83 
    82     "
    84     "
    83      ShowMeHowItWorks do:
    85      ShowMeHowItWorks do:
    84         #(
    86         #(
    85             (language: de)
    87             (language: de)
    86             (show: 'üben üben üben')
    88             (show: 'üben üben üben')
    87             (wait: 0.5)
    89             (wait: 0.5)
    88             (moveTo: NameOfComponent)
    90             (moveTo: NameOfComponent)
    89         )    
    91         )    
    90     "
    92     "
    91 
    93 
   103 
   105 
   104     "
   106     "
   105      ShowMeHowItWorks 
   107      ShowMeHowItWorks 
   106         do:#(
   108         do:#(
   107             (language: de)
   109             (language: de)
   108             (show: 'üben üben üben')
   110             (show: 'üben üben üben')
   109             (wait: 0.5)
   111             (wait: 0.5)
   110             (moveTo: NameOfComponent)
   112             (moveTo: NameOfComponent)
   111         )
   113         )
   112         withUI:true
   114         withUI:true
   113     "
   115     "
   123 
   125 
   124     "
   126     "
   125      ShowMeHowItWorks 
   127      ShowMeHowItWorks 
   126         do:#(
   128         do:#(
   127             (language: de)
   129             (language: de)
   128             (show: 'üben üben üben')
   130             (show: 'üben üben üben')
   129             (wait: 0.5)
   131             (wait: 0.5)
   130             (moveTo: NameOfComponent)
   132             (moveTo: NameOfComponent)
   131         )
   133         )
   132         withUI:true
   134         withUI:true
   133     "
   135     "
  1039     ] ifFalse:[
  1041     ] ifFalse:[
  1040         app isMenuItem ifTrue:[
  1042         app isMenuItem ifTrue:[
  1041             window := app submenu.
  1043             window := app submenu.
  1042         ]
  1044         ]
  1043     ].
  1045     ].
  1044     
  1046     window notNil ifTrue:[
       
  1047         window shown ifFalse:[^ nil].
       
  1048     ].
       
  1049 
  1045     "/ mhmh - search through all widgets of anApplication; 
  1050     "/ mhmh - search through all widgets of anApplication; 
  1046     "/ maybe it was not created via the builder/spec,
  1051     "/ maybe it was not created via the builder/spec,
  1047     "/ or it has changed its name.
  1052     "/ or it has changed its name.
  1048     "/ look for: widget's name, widget's title, widget's label
  1053     "/ look for: widget's name, widget's title, widget's label
  1049     foundByName := OrderedCollection new. 
  1054     foundByName := OrderedCollection new. 
  1050     foundByTitle := OrderedCollection new. 
  1055     foundByTitle := OrderedCollection new. 
  1051     foundByLabel := OrderedCollection new.
  1056     foundByLabel := OrderedCollection new.
  1052     
  1057 
  1053     window withAllSubViewsDo:[:each |
  1058     window withAllSubViewsDo:[:each |
  1054         |foundIt|
  1059         |foundIt|
  1055         
  1060         
  1056         foundIt := false.
  1061         foundIt := false.
  1057         each shown ifTrue:[
  1062         each shown ifTrue:[
  1165                 component notNil ifTrue:[ 
  1170                 component notNil ifTrue:[ 
  1166                     candidates add:component
  1171                     candidates add:component
  1167                 ].
  1172                 ].
  1168             ].
  1173             ].
  1169         ].
  1174         ].
       
  1175         candidates isEmpty ifTrue:[
       
  1176             Display allTopViews do:[:eachTopView |
       
  1177                 component := self findComponent:componentName in:eachTopView.
       
  1178                 component notNil ifTrue:[ 
       
  1179                     candidates add:component
       
  1180                 ].
       
  1181             ]
       
  1182         ].
  1170 
  1183 
  1171         candidates size == 1 ifTrue:[
  1184         candidates size == 1 ifTrue:[
  1172             ^ candidates first
  1185             ^ candidates first
  1173         ].
  1186         ].
  1174         candidates notEmpty ifTrue:[
  1187         candidates notEmpty ifTrue:[