xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Public Member Functions | Protected Member Functions | List of all members
xtd::forms::input_dialog Class Reference

#include <input_dialog.h>

Definition

Represents a common dialog box that displays input dialog.

Namespace
xtd::forms
Library
xtd.forms
Examples
The following code example demonstrate the use of input_dialog dialog.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
text("Input dialog example");
controls().push_back_range({button1, label1});
button1.location({10, 10});
button1.text("Text...");
button1.click += [&] {
input_dialog.text("Caption text");
input_dialog.message("Message text");
input_dialog.value(label1.text());
if (input_dialog.show_sheet_dialog(*this) == dialog_result::ok)
label1.text(input_dialog.value());
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("Default value");
}
private:
label label1;
};
}
int main() {
application::run(examples::form1());
}
Examples
The following code example demonstrate the use of input_dialog dialog with multiline.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
auto_scroll(true);
text("Input dialog multiline example");
controls().push_back_range({button1, label1});
button1.location({10, 10});
button1.auto_size(true);
button1.text("Lines...");
button1.click += [&] {
input_dialog input_dialog;
input_dialog.multiline(true);
input_dialog.word_wrap(false);
input_dialog.text("Enter lines");
input_dialog.value(label1.text());
if (input_dialog.show_dialog(*this) == dialog_result::ok)
label1.text(input_dialog.value());
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("line 1\nline 2");
}
private:
label label1;
};
}
int main() {
application::run(examples::form1());
}
Examples
The following code example demonstrate the use of input_dialog dialog with password.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
text("Input dialog password example");
controls().push_back_range({button1, label1});
button1.location({10, 10});
button1.auto_size(true);
button1.text("Password...");
button1.click += [&] {
input_dialog input_dialog;
input_dialog.text("User password");
input_dialog.message("user: admin");
input_dialog.use_system_password_char(true);
input_dialog.value(label1.text());
if (input_dialog.show_sheet_dialog(*this) == dialog_result::ok)
label1.text(input_dialog.value());
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("sysad47@74dasys");
}
private:
label label1;
};
}
int main() {
application::run(examples::form1());
}
Examples:
input_dialog.cpp, input_dialog_multiline.cpp, and input_dialog_password.cpp.

Public Member Functions

 input_dialog ()=default
 Initializes a new instance of the input_dialog class. More...
 
xtd::forms::character_casing character_casing () const
 Gets the character casing. More...
 
input_dialogcharacter_casing (xtd::forms::character_casing character_casing)
 Sets the character casing. More...
 
xtd::forms::dialog_style dialog_style () const
 Gets the dialog style. More...
 
input_dialogdialog_style (xtd::forms::dialog_style dialog_style)
 Sets the dialog style. More...
 
xtd::ustring message () const
 Gets the text message. More...
 
input_dialogmessage (const xtd::ustring &message)
 Sets the text message. More...
 
bool multiline () const
 Gets multiline status. More...
 
input_dialogmultiline (bool multiline)
 Sets multiline status. More...
 
void reset () override
 Resets all properties to empty string. More...
 
xtd::ustring text () const
 Gets the dialog caption text. More...
 
input_dialogtext (const xtd::ustring &text)
 Sets the dialog caption text. More...
 
bool use_system_password_char () const
 Gets use system password char status. More...
 
input_dialoguse_system_password_char (bool use_system_password_char)
 Sets use system password char status. More...
 
xtd::ustring value () const
 Gets the value. More...
 
input_dialogvalue (const xtd::ustring &value)
 Sets the value. More...
 
bool word_wrap () const
 Gets word wrap status. More...
 
input_dialogword_wrap (bool word_wrap)
 Sets word wrap status. More...
 
- Public Member Functions inherited from xtd::forms::common_dialog
 common_dialog ()=default
 Initializes a new instance of the common_dialog class. More...
 
xtd::forms::dialog_result dialog_result () const
 Get async dialog_result result after dialog box is closing. More...
 
xtd::forms::dialog_result show_dialog ()
 Runs a common dialog box with a default owner. More...
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
void show_sheet (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner. More...
 
std::any tag () const
 Gets an object that contains data about the control. More...
 
common_dialogtag (const std::any &tag)
 Sets an object that contains data about the control. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object. More...
 

Protected Member Functions

bool run_dialog (intptr_t owner) override
 When overridden in a derived class, specifies a common dialog box. More...
 
void run_sheet (intptr_t owner) override
 When overridden in a derived class, specifies a common dialog box. More...
 
- Protected Member Functions inherited from xtd::forms::common_dialog
virtual void on_dialog_closed (const dialog_closed_event_args &e)
 Raises the common_dialog::dialog_close event. More...
 
virtual void on_help_request (help_event_args &e)
 Raises the common_dialog::help_request event. More...
 
- Protected Member Functions inherited from xtd::forms::component
 component ()=default
 Initialises a new instance of the component class. More...
 
virtual bool can_raise_events () const
 Gets a value indicating whether the component can raise an event. More...
 
bool design_mode () const
 Gets a value that indicates whether the component is currently in design mode. More...
 

Additional Inherited Members

- Public Attributes inherited from xtd::forms::common_dialog
event< common_dialog, dialog_closed_event_handlerdialog_closed
 Occurs when the user close a common dialog box with dialog close button or other dialog buttons. More...
 
event< common_dialog, help_event_handlerhelp_request
 Occurs when the user clicks the Help button on a common dialog box. More...
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Constructor & Destructor Documentation

◆ input_dialog()

xtd::forms::input_dialog::input_dialog ( )
default

Initializes a new instance of the input_dialog class.

Member Function Documentation

◆ character_casing() [1/2]

xtd::forms::character_casing xtd::forms::input_dialog::character_casing ( ) const
inline

Gets the character casing.

Returns
One of the xtd::forms::character_casing values. The default value is xtd::forms::character_casing::normal.

◆ character_casing() [2/2]

input_dialog& xtd::forms::input_dialog::character_casing ( xtd::forms::character_casing  character_casing)
inline

Sets the character casing.

Parameters
dialog_styleOne of the xtd::forms::character_casing values. The default value is xtd::forms::character_casing::normal.
Returns
Current input instance.

◆ dialog_style() [1/2]

xtd::forms::dialog_style xtd::forms::input_dialog::dialog_style ( ) const
inline

Gets the dialog style.

Returns
One of the xtd::forms::dialog_style values. The default value is xtd::forms::dialog_style::standard.

◆ dialog_style() [2/2]

input_dialog& xtd::forms::input_dialog::dialog_style ( xtd::forms::dialog_style  dialog_style)
inline

Sets the dialog style.

Parameters
dialog_styleOne of the xtd::forms::dialog_style values. The default value is xtd::forms::dialog_style::standard.
Returns
Current input instance.

◆ message() [1/2]

xtd::ustring xtd::forms::input_dialog::message ( ) const
inline

Gets the text message.

Returns
The text message.
Examples:
input_dialog.cpp, and input_dialog_password.cpp.

◆ message() [2/2]

input_dialog& xtd::forms::input_dialog::message ( const xtd::ustring message)
inline

Sets the text message.

Parameters
messageThe text message.
Returns
Current input_dialog instance.

◆ multiline() [1/2]

bool xtd::forms::input_dialog::multiline ( ) const
inline

Gets multiline status.

Returns
true if dialog text box is multiline; otherwise false.
Remarks
The default value is false.
Examples:
input_dialog_multiline.cpp.

◆ multiline() [2/2]

input_dialog& xtd::forms::input_dialog::multiline ( bool  multiline)
inline

Sets multiline status.

Parameters
multilinetrue if dialog text box is multiline; otherwise false.
Returns
Current input_dialog instance.
Remarks
The default value is false.

◆ reset()

void xtd::forms::input_dialog::reset ( )
overridevirtual

Resets all properties to empty string.

Implements xtd::forms::common_dialog.

◆ run_dialog()

bool xtd::forms::input_dialog::run_dialog ( intptr_t  hwnd_owner)
overrideprotectedvirtual

When overridden in a derived class, specifies a common dialog box.

Parameters
hwnd_ownerA value that represents the window handle of the owner window for the common dialog box.
Returns
true if the dialog box was successfully run; otherwise, false.

Implements xtd::forms::common_dialog.

◆ run_sheet()

void xtd::forms::input_dialog::run_sheet ( intptr_t  hwnd_owner)
overrideprotectedvirtual

When overridden in a derived class, specifies a common dialog box.

Parameters
hwnd_ownerA value that represents the window handle of the owner window for the common dialog box.
Returns
true if the dialog box was successfully run; otherwise, false.
Remarks
The result will done in async. Check result_dialog property after dialog box closed to obtain the result.

Implements xtd::forms::common_dialog.

◆ text() [1/2]

xtd::ustring xtd::forms::input_dialog::text ( ) const
inline

Gets the dialog caption text.

Returns
The current dialog caption text.
Examples:
input_dialog.cpp, input_dialog_multiline.cpp, and input_dialog_password.cpp.

◆ text() [2/2]

input_dialog& xtd::forms::input_dialog::text ( const xtd::ustring text)
inline

Sets the dialog caption text.

Parameters
textThe new dialog caption text.
Returns
Current input_dialog instance.

◆ use_system_password_char() [1/2]

bool xtd::forms::input_dialog::use_system_password_char ( ) const
inline

Gets use system password char status.

Returns
true if dialog text box use system password char status; otherwise false.
Remarks
The default value is false.
Examples:
input_dialog_password.cpp.

◆ use_system_password_char() [2/2]

input_dialog& xtd::forms::input_dialog::use_system_password_char ( bool  use_system_password_char)
inline

Sets use system password char status.

Parameters
use_system_password_chartrue if dialog text box use system password char status; otherwise false.
Returns
Current input_dialog instance.
Remarks
The default value is false.

◆ value() [1/2]

xtd::ustring xtd::forms::input_dialog::value ( ) const
inline

Gets the value.

Returns
The value.
Examples:
input_dialog.cpp, input_dialog_multiline.cpp, and input_dialog_password.cpp.

◆ value() [2/2]

input_dialog& xtd::forms::input_dialog::value ( const xtd::ustring value)
inline

Sets the value.

Parameters
valueThe value.
Returns
Current input_dialog instance.

◆ word_wrap() [1/2]

bool xtd::forms::input_dialog::word_wrap ( ) const
inline

Gets word wrap status.

Returns
true if dialog text box is word wrap; otherwise false.
Remarks
The default value is true.
Examples:
input_dialog_multiline.cpp.

◆ word_wrap() [2/2]

input_dialog& xtd::forms::input_dialog::word_wrap ( bool  word_wrap)
inline

Sets word wrap status.

Parameters
word_wraptrue if dialog text box is word wrap; otherwise false.
Returns
Current input_dialog instance.
Remarks
The default value is true.

The documentation for this class was generated from the following file: