1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

Userland: Use default buttons instead of manually handling return press

Besides simplifying the code, this will also draw outline for these
buttons as a cue for a user!
This commit is contained in:
Karol Kosek 2022-05-27 19:36:06 +02:00 committed by Andreas Kling
parent a232395b77
commit 9f1f1b8472
8 changed files with 8 additions and 39 deletions

View file

@ -71,21 +71,14 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent)
m_name_input->on_change = [&]() {
update_dialog();
};
m_name_input->on_return_pressed = [&]() {
if (m_input_valid)
do_create_project();
};
m_create_in_input = *main_widget.find_descendant_of_type_named<GUI::TextBox>("create_in_input");
m_create_in_input->on_change = [&]() {
update_dialog();
};
m_create_in_input->on_return_pressed = [&]() {
if (m_input_valid)
do_create_project();
};
m_full_path_label = *main_widget.find_descendant_of_type_named<GUI::Label>("full_path_label");
m_ok_button = *main_widget.find_descendant_of_type_named<GUI::Button>("ok_button");
m_ok_button->set_default(true);
m_ok_button->on_click = [this](auto) {
do_create_project();
};