Skip to content

Commit 7d6cf7c

Browse files
committed
A few more changes
1 parent 2b16e8a commit 7d6cf7c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/classes/SearchHistoryPopup.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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+
137139
void SearchHistoryPopup::page(int p) {
138140
m_scrollLayer->m_contentLayer->removeAllChildren();
139141

src/classes/SearchHistoryPopup.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
typedef geode::Function<void(int)> SearchHistoryCallback;
88

9-
class SearchHistoryPopup : public geode::Popup, public FLAlertLayerProtocol {
9+
class SearchHistoryPopup : public geode::Popup, public FLAlertLayerProtocol, public TextInputDelegate {
1010
protected:
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;
2728
public:
2829
static SearchHistoryPopup* create(SearchHistoryCallback);
2930

0 commit comments

Comments
 (0)