# HG changeset patch # User Claus Gittinger # Date 1563602452 -7200 # Node ID 08e97653176e3cbec7b104b2b8054edda12ef6e7 # Parent 8e37e3d91789d595cd2e3f8077100a97f49d4dc6 #BUGFIX by cg class: ShowMeHowItWorks added: #selectIndex:in: changed: #randomThankYou #selectIndex: diff -r 8e37e3d91789 -r 08e97653176e ShowMeHowItWorks.st --- a/ShowMeHowItWorks.st Fri Jul 19 21:49:42 2019 +0200 +++ b/ShowMeHowItWorks.st Sat Jul 20 08:00:52 2019 +0200 @@ -315,9 +315,24 @@ - |widget y offset| + self selectIndex:itemsIndex in:lastComponent + + "Created: / 19-07-2019 / 14:20:11 / Claus Gittinger" + "Modified: / 19-07-2019 / 21:59:36 / Claus Gittinger" +! - (widget := lastComponent) isScrollWrapper ifTrue:[ +selectIndex:itemsIndex in:widgetArg + "select an item by index, + allowed after moving to: + aComboBox + aSelectionInListView + " + + + + |widget y offset possibleWidgets| + + (widget := widgetArg) isScrollWrapper ifTrue:[ widget := widget scrolledView ]. @@ -332,6 +347,9 @@ ^ self ]. (widget isKindOf:SelectionInListView) ifTrue:[ + (widget isLineVisible:itemsIndex) ifFalse:[ + widget scrollToLine:itemsIndex + ]. "/ click on the item y := widget yOfLine:itemsIndex. offset := (widget width // 2) @ y. @@ -341,11 +359,40 @@ widget simulateButtonRelease:1 at:offset sendDisplayEvent:false. Delay waitForSeconds:0.5. ^ self + ]. + (widget isKindOf:SelectionInListModelView) ifTrue:[ + (widget isLineVisible:itemsIndex) ifFalse:[ + widget scrollToLine:itemsIndex + ]. + y := widget yVisibleOfLine:itemsIndex. + offset := (widget width // 2) @ y. + self movePointerToComponent:widget offset:offset. + widget simulateButtonPress:1 at:offset sendDisplayEvent:false. + Delay waitForSeconds:(self clickTime). + widget simulateButtonRelease:1 at:offset sendDisplayEvent:false. + Delay waitForSeconds:0.5. + ^ self + ]. + + "/ none of it - see what is in there + possibleWidgets := OrderedCollection new. + widget allSubViewsDo:[:each | + ((each isKindOf:ComboView) + or:[(each isKindOf:SelectionInListView) + or:[(each isKindOf:SelectionInListModelView) + ]]) ifTrue:[ + possibleWidgets add:each + ] + ]. + possibleWidgets size == 1 ifTrue:[ + self selectIndex:itemsIndex in:(possibleWidgets first). + ^ self ]. + self error:'cannot select this component' - "Created: / 19-07-2019 / 14:20:11 / Claus Gittinger" - "Modified: / 19-07-2019 / 16:22:47 / Claus Gittinger" + "Created: / 19-07-2019 / 21:59:15 / Claus Gittinger" + "Modified: / 20-07-2019 / 07:57:41 / Claus Gittinger" ! type:aString @@ -547,7 +594,7 @@ " OperatingSystem speak:'have fun with expecco' - OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"' + OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin' OperatingSystem speak:'happy hacking, I hope you liked what you saw' OperatingSystem speak:'please give feedback, and let us know, if you liked it' OperatingSystem speak:'if you have any questions, please contact exept'