diff options
author | Tom <tomut@yahoo.com> | 2020-07-16 07:54:42 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-16 16:10:21 +0200 |
commit | 65a11fb5f913be1e403e47222fb7a696100b2323 (patch) | |
tree | 0d2d551bb772cac884ea758a41a79257fd10b913 /DevTools/HackStudio | |
parent | 27bd2eab2288c79206f3571bc2c46a20fc9a4254 (diff) | |
download | serenity-65a11fb5f913be1e403e47222fb7a696100b2323.zip |
LibGUI: Add InputBox::show with required parent window argument
Similar to MessageBox::show, this encourages passing in a window.
Diffstat (limited to 'DevTools/HackStudio')
-rw-r--r-- | DevTools/HackStudio/Debugger/DebugInfoWidget.cpp | 7 | ||||
-rw-r--r-- | DevTools/HackStudio/main.cpp | 5 |
2 files changed, 5 insertions, 7 deletions
diff --git a/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp index 7ef5299dac..2b310fa7dd 100644 --- a/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp +++ b/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp @@ -84,11 +84,10 @@ DebugInfoWidget::DebugInfoWidget() if (!is_valid_index(index)) return; - auto input = GUI::InputBox::construct("Enter new value:", "Set variable value", window()); - - if (input->exec() == GUI::InputBox::ExecOK) { + String value; + if (GUI::InputBox::show(value, window(), "Enter new value:", "Set variable value") == GUI::InputBox::ExecOK) { auto& model = static_cast<VariablesModel&>(*m_variables_view->model()); - model.set_variable_value(index, input->text_value(), window()); + model.set_variable_value(index, value, window()); } }; } diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp index 13f2937c44..a270ae50c4 100644 --- a/DevTools/HackStudio/main.cpp +++ b/DevTools/HackStudio/main.cpp @@ -203,10 +203,9 @@ int main(int argc, char** argv) }; auto new_action = GUI::Action::create("Add new file to project...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) { - auto input_box = GUI::InputBox::construct("Enter name of new file:", "Add new file to project", g_window); - if (input_box->exec() == GUI::InputBox::ExecCancel) + String filename; + if (GUI::InputBox::show(filename, g_window, "Enter name of new file:", "Add new file to project") != GUI::InputBox::ExecOK) return; - auto filename = input_box->text_value(); auto file = Core::File::construct(filename); if (!file->open((Core::IODevice::OpenMode)(Core::IODevice::WriteOnly | Core::IODevice::MustBeNew))) { GUI::MessageBox::show(g_window, String::format("Failed to create '%s'", filename.characters()), "Error", GUI::MessageBox::Type::Error); |