summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/InputBox.cpp6
-rw-r--r--Userland/Libraries/LibGUI/InputBox.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp
index 5c85779091..a50fd75aa2 100644
--- a/Userland/Libraries/LibGUI/InputBox.cpp
+++ b/Userland/Libraries/LibGUI/InputBox.cpp
@@ -34,8 +34,9 @@
namespace GUI {
-InputBox::InputBox(Window* parent_window, const StringView& prompt, const StringView& title)
+InputBox::InputBox(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title)
: Dialog(parent_window)
+ , m_text_value(text_value)
, m_prompt(prompt)
{
set_title(title);
@@ -48,7 +49,7 @@ InputBox::~InputBox()
int InputBox::show(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title)
{
- auto box = InputBox::construct(parent_window, prompt, title);
+ auto box = InputBox::construct(parent_window, text_value, prompt, title);
box->set_resizable(false);
if (parent_window)
box->set_icon(parent_window->icon());
@@ -81,6 +82,7 @@ void InputBox::build()
m_text_editor = label_editor_container.add<TextBox>();
m_text_editor->set_fixed_height(19);
+ m_text_editor->set_text(m_text_value);
auto& button_container_outer = widget.add<Widget>();
button_container_outer.set_fixed_height(20);
diff --git a/Userland/Libraries/LibGUI/InputBox.h b/Userland/Libraries/LibGUI/InputBox.h
index c2fa24f282..6a91003855 100644
--- a/Userland/Libraries/LibGUI/InputBox.h
+++ b/Userland/Libraries/LibGUI/InputBox.h
@@ -38,13 +38,13 @@ public:
static int show(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
private:
- explicit InputBox(Window* parent_window, const StringView& prompt, const StringView& title);
+ explicit InputBox(Window* parent_window, String& text_value, const StringView& prompt, const StringView& title);
String text_value() const { return m_text_value; }
void build();
- String m_prompt;
String m_text_value;
+ String m_prompt;
RefPtr<Button> m_ok_button;
RefPtr<Button> m_cancel_button;