File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -80,9 +80,7 @@ bool SearchHistoryPopup::init(SearchHistoryCallback callback) {
8080 m_searchInput->setCommonFilter (CommonFilter::Any);
8181 m_searchInput->setTextAlign (TextInputAlign::Left);
8282 m_searchInput->setPosition ({ 200 .0f , 235 .0f });
83- m_searchInput->setCallback ([this ](auto ) {
84- page (0 );
85- });
83+ m_searchInput->setDelegate (this );
8684 m_searchInput->setID (" search-input" );
8785 m_mainLayer->addChild (m_searchInput);
8886
@@ -134,6 +132,10 @@ void SearchHistoryPopup::onFilter(CCObject* sender) {
134132 })->show ();
135133}
136134
135+ void SearchHistoryPopup::textChanged (CCTextInputNode* input) {
136+ page (0 );
137+ }
138+
137139void SearchHistoryPopup::page (int p) {
138140 m_scrollLayer->m_contentLayer ->removeAllChildren ();
139141
Original file line number Diff line number Diff line change 66
77typedef geode::Function<void (int )> SearchHistoryCallback;
88
9- class SearchHistoryPopup : public geode ::Popup, public FLAlertLayerProtocol {
9+ class SearchHistoryPopup : public geode ::Popup, public FLAlertLayerProtocol, public TextInputDelegate {
1010protected:
1111 SearchHistoryObject m_searchFilter;
1212 geode::ScrollLayer* m_scrollLayer;
@@ -24,6 +24,7 @@ class SearchHistoryPopup : public geode::Popup, public FLAlertLayerProtocol {
2424 void onClear (cocos2d::CCObject*);
2525 void FLAlert_Clicked (FLAlertLayer*, bool ) override ;
2626 void onFilter (cocos2d::CCObject*);
27+ void textChanged (CCTextInputNode*) override ;
2728public:
2829 static SearchHistoryPopup* create (SearchHistoryCallback);
2930
You can’t perform that action at this time.
0 commit comments