mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-29 20:59:00 +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:
parent
a232395b77
commit
9f1f1b8472
Notes:
sideshowbarker
2024-07-17 10:30:10 +09:00
Author: https://github.com/krkk
Commit: 9f1f1b8472
Pull-request: https://github.com/SerenityOS/serenity/pull/14172
Reviewed-by: https://github.com/AtkinsSJ ✅
8 changed files with 8 additions and 39 deletions
|
@ -57,20 +57,15 @@ private:
|
|||
m_title_textbox->set_text(title);
|
||||
m_title_textbox->set_focus(true);
|
||||
m_title_textbox->select_all();
|
||||
m_title_textbox->on_return_pressed = [this] {
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
m_url_textbox = *widget.find_descendant_of_type_named<GUI::TextBox>("url_textbox");
|
||||
m_url_textbox->set_text(url);
|
||||
m_url_textbox->on_return_pressed = [this] {
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
auto& ok_button = *widget.find_descendant_of_type_named<GUI::Button>("ok_button");
|
||||
ok_button.on_click = [this](auto) {
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
ok_button.set_default(true);
|
||||
|
||||
auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
|
||||
cancel_button.on_click = [this](auto) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue