Skip to content

Commit

Permalink
Improved the search box event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich authored and past-due committed Jun 2, 2024
1 parent 38843f9 commit c3c09e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/multimenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,13 @@ void addMultiRequest(const char *searchDir, const char *fileExtension, UDWORD mo
searchBox->setPlaceholder(_("Search for map"));
searchBox->setString(WzString::fromUtf8(current_searchString));

searchBox->setOnReturnHandler([searchDir, fileExtension, mode, numPlayers](W_EDITBOX& widg) {
searchBox->setOnEditingStoppedHandler([searchDir, fileExtension, mode, numPlayers](W_EDITBOX& widg) {
const std::string &value = widg.getString().toUtf8();
if (value == current_searchString) {
return;
}
closeMultiRequester();
addMultiRequest(searchDir, fileExtension, mode, numPlayers, widg.getString().toUtf8());
addMultiRequest(searchDir, fileExtension, mode, numPlayers, value);
});

multiRequestUp = true;
Expand Down

0 comments on commit c3c09e8

Please sign in to comment.