ShowMeHowItWorks.st
changeset 3716 08e97653176e
parent 3715 8e37e3d91789
child 3717 26224649d91c
equal deleted inserted replaced
3715:8e37e3d91789 3716:08e97653176e
   313         aSelectionInListView
   313         aSelectionInListView
   314     "    
   314     "    
   315 
   315 
   316     <action>
   316     <action>
   317 
   317 
   318     |widget y offset|
   318     self selectIndex:itemsIndex in:lastComponent
   319 
   319 
   320     (widget := lastComponent) isScrollWrapper ifTrue:[
   320     "Created: / 19-07-2019 / 14:20:11 / Claus Gittinger"
       
   321     "Modified: / 19-07-2019 / 21:59:36 / Claus Gittinger"
       
   322 !
       
   323 
       
   324 selectIndex:itemsIndex in:widgetArg
       
   325     "select an item by index,
       
   326      allowed after moving to:
       
   327         aComboBox
       
   328         aSelectionInListView
       
   329     "    
       
   330 
       
   331     <action>
       
   332 
       
   333     |widget y offset possibleWidgets|
       
   334 
       
   335     (widget := widgetArg) isScrollWrapper ifTrue:[
   321         widget := widget scrolledView
   336         widget := widget scrolledView
   322     ].
   337     ].
   323     
   338     
   324     (widget isKindOf:ComboView) ifTrue:[
   339     (widget isKindOf:ComboView) ifTrue:[
   325         "/ click on the menubutton
   340         "/ click on the menubutton
   330         Delay waitForSeconds:0.5.
   345         Delay waitForSeconds:0.5.
   331 self halt.
   346 self halt.
   332         ^ self
   347         ^ self
   333     ].    
   348     ].    
   334     (widget isKindOf:SelectionInListView) ifTrue:[
   349     (widget isKindOf:SelectionInListView) ifTrue:[
       
   350         (widget isLineVisible:itemsIndex) ifFalse:[
       
   351             widget scrollToLine:itemsIndex
       
   352         ].    
   335         "/ click on the item
   353         "/ click on the item
   336         y := widget yOfLine:itemsIndex.
   354         y := widget yOfLine:itemsIndex.
   337         offset := (widget width // 2) @ y.
   355         offset := (widget width // 2) @ y.
   338         self movePointerToComponent:widget offset:offset.
   356         self movePointerToComponent:widget offset:offset.
   339         widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
   357         widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
   340         Delay waitForSeconds:(self clickTime).
   358         Delay waitForSeconds:(self clickTime).
   341         widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
   359         widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
   342         Delay waitForSeconds:0.5.
   360         Delay waitForSeconds:0.5.
   343         ^ self
   361         ^ self
       
   362     ].
       
   363     (widget isKindOf:SelectionInListModelView) ifTrue:[
       
   364         (widget isLineVisible:itemsIndex) ifFalse:[
       
   365             widget scrollToLine:itemsIndex
       
   366         ].    
       
   367         y := widget yVisibleOfLine:itemsIndex.
       
   368         offset := (widget width // 2) @ y.
       
   369         self movePointerToComponent:widget offset:offset.
       
   370         widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
       
   371         Delay waitForSeconds:(self clickTime).
       
   372         widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
       
   373         Delay waitForSeconds:0.5.
       
   374         ^ self
       
   375     ].
       
   376 
       
   377     "/ none of it - see what is in there
       
   378     possibleWidgets := OrderedCollection new.
       
   379     widget allSubViewsDo:[:each |
       
   380         ((each isKindOf:ComboView) 
       
   381           or:[(each isKindOf:SelectionInListView)
       
   382           or:[(each isKindOf:SelectionInListModelView)
       
   383         ]]) ifTrue:[
       
   384             possibleWidgets add:each
       
   385         ]
       
   386     ].
       
   387     possibleWidgets size == 1 ifTrue:[
       
   388         self selectIndex:itemsIndex in:(possibleWidgets first).
       
   389         ^ self
   344     ].    
   390     ].    
       
   391     
   345     self error:'cannot select this component'
   392     self error:'cannot select this component'
   346 
   393 
   347     "Created: / 19-07-2019 / 14:20:11 / Claus Gittinger"
   394     "Created: / 19-07-2019 / 21:59:15 / Claus Gittinger"
   348     "Modified: / 19-07-2019 / 16:22:47 / Claus Gittinger"
   395     "Modified: / 20-07-2019 / 07:57:41 / Claus Gittinger"
   349 !
   396 !
   350 
   397 
   351 type:aString
   398 type:aString
   352     "enter text into the last component"
   399     "enter text into the last component"
   353 
   400 
   545         'if you need more information, please take a look at the wiki'
   592         'if you need more information, please take a look at the wiki'
   546     ) atRandom
   593     ) atRandom
   547 
   594 
   548     "
   595     "
   549      OperatingSystem speak:'have fun with expecco'
   596      OperatingSystem speak:'have fun with expecco'
   550      OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"'
   597      OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin'
   551      OperatingSystem speak:'happy hacking, I hope you liked what you saw'
   598      OperatingSystem speak:'happy hacking, I hope you liked what you saw'
   552      OperatingSystem speak:'please give feedback, and let us know, if you liked it'
   599      OperatingSystem speak:'please give feedback, and let us know, if you liked it'
   553      OperatingSystem speak:'if you have any questions, please contact exept'
   600      OperatingSystem speak:'if you have any questions, please contact exept'
   554      OperatingSystem speak:'if you need more information, please take a look at the wiki'
   601      OperatingSystem speak:'if you need more information, please take a look at the wiki'
   555     "
   602     "