mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 10:01:13 +09:00
LibGUI: Add InputBox::show with required parent window argument
Similar to MessageBox::show, this encourages passing in a window.
This commit is contained in:
parent
27bd2eab22
commit
65a11fb5f9
Notes:
sideshowbarker
2024-07-19 04:46:07 +09:00
Author: https://github.com/tomuta
Commit: 65a11fb5f9
Pull-request: https://github.com/SerenityOS/serenity/pull/2820
11 changed files with 99 additions and 94 deletions
|
@ -87,10 +87,9 @@ void TextEditor::create_actions()
|
|||
if (is_multi_line()) {
|
||||
m_go_to_line_action = Action::create(
|
||||
"Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](auto&) {
|
||||
auto input_box = InputBox::construct("Line:", "Go to line", window());
|
||||
auto result = input_box->exec();
|
||||
if (result == InputBox::ExecOK) {
|
||||
auto line_number = input_box->text_value().to_uint();
|
||||
String value;
|
||||
if (InputBox::show(value, window(), "Line:", "Go to line") == InputBox::ExecOK) {
|
||||
auto line_number = value.to_uint();
|
||||
if (line_number.has_value())
|
||||
set_cursor(line_number.value() - 1, 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue