Skip to content

Commit

Permalink
plugin: make sure people enter a name
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepVanlier committed Sep 2, 2024
1 parent b68f227 commit e43dbf5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugin/components/modal_textinputbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ static void show_async_text_input(juce::String title, juce::String message, std:
auto inputFilter = std::make_unique<ExclusionFilter>("`");
textEditor->setInputFilter(inputFilter.release(), true);

auto finalize_success = [window, textEditor, callback]() { callback(textEditor->getText(), true); window->exitModalState(0); };
auto finalize_success = [window, textEditor, callback]() {
if (textEditor->getText().isEmpty()) {
window->setMessage("Please enter a preset name or press cancel.");
} else {
callback(textEditor->getText(), true); window->exitModalState(0);
};
};
auto finalize_cancel = [window, textEditor, callback]() { callback(textEditor->getText(), false); window->exitModalState(0); };

textEditor->onReturnKey = finalize_success;
Expand Down

0 comments on commit e43dbf5

Please sign in to comment.