diff --git a/src/Toplo-Examples/ToSandBox.class.st b/src/Toplo-Examples/ToSandBox.class.st index 01c3c976..5839d042 100644 --- a/src/Toplo-Examples/ToSandBox.class.st +++ b/src/Toplo-Examples/ToSandBox.class.st @@ -1740,7 +1740,7 @@ ToSandBox class >> example_SelectAntDesignIconMonoFiltrable [ withIconProvider: ToAntDesignIconProvider. select filtrable: true. - + select sample: (select popupListElement dataAccessor at: 1). select dataViewBuilder: [ :dataItemView :iconDesc | dataItemView addChild: ((iconDesc icon size: 48 asPoint) background: Color veryLightGray). @@ -1751,8 +1751,6 @@ ToSandBox class >> example_SelectAntDesignIconMonoFiltrable [ dataItemView childrenDo: [ :child | child constraintsDo: [ :c | c linear vertical alignCenter ] ] ]. - select sample: (select popupListElement dataAccessor at: 1). - select hMatchParent. select placeholderText: ('Select an icon' asRopedText foreground: Color red). @@ -1861,6 +1859,7 @@ ToSandBox class >> example_SelectMonoFiltrable [ yourself) fontSize: 24; yourself. + select sample: 'X'. select popupListElement placeholderBuilder: [ :placeholder :e | | lab | placeholder layout alignCenter. @@ -1868,7 +1867,7 @@ ToSandBox class >> example_SelectMonoFiltrable [ placeholder addChild: lab ]. select dataViewBuilder: [ :dataItemView :aString | dataItemView addChild: ((ToLabel text: aString) - fontSize: 28; + fontSize: 18; yourself) ]. select filtrable: true. diff --git a/src/Toplo-Widget-List/ToInfiniteDataSourceManager.class.st b/src/Toplo-Widget-List/ToInfiniteDataSourceManager.class.st index 2064ce5f..93b1f7d5 100644 --- a/src/Toplo-Widget-List/ToInfiniteDataSourceManager.class.st +++ b/src/Toplo-Widget-List/ToInfiniteDataSourceManager.class.st @@ -47,7 +47,7 @@ ToInfiniteDataSourceManager >> onItemsSieved: aPositionStart itemCount: anItemCo "Return true if pending commands should be processed, otherwise false" - "Register add command" + "Register the sieve command" finalStepCommands add: (ToInfiniteDataSourceSieveCommand new positionStart: aPositionStart; itemCount: anItemCount; diff --git a/src/Toplo-Widget-List/ToListElementEventHandler.class.st b/src/Toplo-Widget-List/ToListElementEventHandler.class.st index 7490eaa9..9e4bee7c 100644 --- a/src/Toplo-Widget-List/ToListElementEventHandler.class.st +++ b/src/Toplo-Widget-List/ToListElementEventHandler.class.st @@ -298,9 +298,7 @@ ToListElementEventHandler >> secondaryClickEvent: anEvent [ { #category : #'list element handling' } ToListElementEventHandler >> showHidePlaceholderIn: aListElement [ - aListElement dataAccessor ifEmpty: [ - aListElement selecter deselectAll. - ^ aListElement showPlaceholder ]. + aListElement dataAccessor ifEmpty: [ ^ aListElement showPlaceholder ]. aListElement hidePlaceholder ] diff --git a/src/Toplo-Widget-Select/ToSelectElement.class.st b/src/Toplo-Widget-Select/ToSelectElement.class.st index 781ab4fa..5c428777 100644 --- a/src/Toplo-Widget-Select/ToSelectElement.class.st +++ b/src/Toplo-Widget-Select/ToSelectElement.class.st @@ -50,7 +50,7 @@ ToSelectElement >> defaultLayout [ { #category : #accessing } ToSelectElement >> filterString [ - ^ self filterTextField filterString + ^ self filterTextField text asString ] { #category : #'accessing - selection' } @@ -206,13 +206,13 @@ ToSelectElement >> onLayout: aBounds context: aBlElementBoundsUpdateContext [ { #category : #window } ToSelectElement >> onPopupWindowClosed [ - self filterTextField onPopupWindowClosed + self filterTextField requestFocus ] { #category : #window } ToSelectElement >> onPopupWindowOpened [ - self filterTextField onPopupWindowOpened + self filterTextField requestFocus ] { #category : #'accessing - selection' } diff --git a/src/Toplo-Widget-Select/ToSelectFilterTextField.class.st b/src/Toplo-Widget-Select/ToSelectFilterTextField.class.st index 798ab503..9a53745e 100644 --- a/src/Toplo-Widget-Select/ToSelectFilterTextField.class.st +++ b/src/Toplo-Widget-Select/ToSelectFilterTextField.class.st @@ -9,12 +9,6 @@ Class { #category : #'Toplo-Widget-Select-textInput' } -{ #category : #accessing } -ToSelectFilterTextField >> filterString [ - - ^ self text asString -] - { #category : #initialization } ToSelectFilterTextField >> initialize [ @@ -78,18 +72,6 @@ ToSelectFilterTextField >> onInstalledIn: aSelectElement [ self infinite addEventHandler: windowPopupHandler ] -{ #category : #window } -ToSelectFilterTextField >> onPopupWindowClosed [ - - self requestFocus -] - -{ #category : #window } -ToSelectFilterTextField >> onPopupWindowOpened [ - - self requestFocus -] - { #category : #'api - hooks' } ToSelectFilterTextField >> onUninstalledIn: aSelectElement [ @@ -114,5 +96,7 @@ ToSelectFilterTextField >> selectFiltrable: aBoolean [ { #category : #accessing } ToSelectFilterTextField >> selectNodeBefore [ - ^ selectInnerContainer nodes ifEmpty: [] ifNotEmpty: [:nodes | nodes last] + ^ selectInnerContainer nodes + ifEmpty: [ ] + ifNotEmpty: [ :nodes | nodes last ] ] diff --git a/src/Toplo-Widget-Select/ToSelectListElement.class.st b/src/Toplo-Widget-Select/ToSelectListElement.class.st index 55ef9ccc..698cfbfe 100644 --- a/src/Toplo-Widget-Select/ToSelectListElement.class.st +++ b/src/Toplo-Widget-Select/ToSelectListElement.class.st @@ -10,11 +10,13 @@ Class { { #category : #'private - commands' } ToSelectListElement >> applyDataSourceSieveCommand: aDataSourceCommand [ " update the selection according to the sieve selection model" + super applyDataSourceSieveCommand: aDataSourceCommand. " the window can be opened but invisible if opened from the text input element. see ToSelectFilterTextField>>onInstalledIn:. #popupWindowHiddenEvent: is sent to the select popup window manager when the filter is changed " - selectElement currentPopupWindow ifNotNil: [:w | w visibility: BlVisibility visible ] + selectElement currentPopupWindow ifNotNil: [ :w | + w visibility: BlVisibility visible ] ] { #category : #accessing } diff --git a/src/Toplo-Widget-Select/ToSingleSelectInnerContainerElement.class.st b/src/Toplo-Widget-Select/ToSingleSelectInnerContainerElement.class.st index c4b4c8ff..6639c9d2 100644 --- a/src/Toplo-Widget-Select/ToSingleSelectInnerContainerElement.class.st +++ b/src/Toplo-Widget-Select/ToSingleSelectInnerContainerElement.class.st @@ -29,7 +29,9 @@ ToSingleSelectInnerContainerElement >> dataViewBuilder: aValuable [ " aValuable takes 2 args: the dataItemView and the selected dataItem " dataViewBuilder := aValuable. - self refreshFromPopupListSelection + self refreshFromPopupListSelection. + fakeDataItem ifNil: [ ^ self ]. + self reinstallFakeDataView ] { #category : #accessing } @@ -48,8 +50,7 @@ ToSingleSelectInnerContainerElement >> defaultLayout [ ToSingleSelectInnerContainerElement >> fakeDataItem: aData [ fakeDataItem := aData. - self uninstallFakeDataView. - self installFakeDataView + self reinstallFakeDataView ] { #category : #'t - select inner container' } @@ -73,7 +74,6 @@ ToSingleSelectInnerContainerElement >> initialize [ hMatchParent; constraintsDo: [ :c | c linear vertical alignCenter ]. - fakeDataItem := 'X'. dataViewFactory := selectElement defaultDataViewFactory. dataViewBuilder := selectElement defaultDataViewBuilder. @@ -156,6 +156,14 @@ ToSingleSelectInnerContainerElement >> refreshFromPopupListSelection [ selectElement dispatchEvent: changedEvent ] +{ #category : #initialization } +ToSingleSelectInnerContainerElement >> reinstallFakeDataView [ + + self uninstallFakeDataView. + self installFakeDataView + +] + { #category : #accessing } ToSingleSelectInnerContainerElement >> sample: aDataItem [