xtd 0.2.0
Loading...
Searching...
No Matches
xtd::forms::input_dialog Class Reference
Inheritance diagram for xtd::forms::input_dialog:
xtd::forms::common_dialog xtd::forms::component xtd::object

Definition

Represents a common dialog box that displays input dialog.

Header
#include <xtd/forms/input_dialog>
Namespace
xtd::forms
Library
xtd.forms
Appearance
Windows macOS Gnome
Light  
 
 
 
 
 
Dark  
 
 
 
 
 
Examples
The following code example demonstrates the use of input_dialog dialog.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/input_dialog>
#include <xtd/forms/label>
using namespace xtd::forms;
namespace input_dialog_example {
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 += [&] {
auto dialog = input_dialog {};
dialog.text("Caption text");
dialog.message("Message text");
dialog.value(label1.text());
if (dialog.show_sheet_dialog(*this) == dialog_result::ok)
label1.text(dialog.value());
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("Default value");
}
private:
label label1;
};
}
auto main() -> int {
application::run(input_dialog_example::form1 {});
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a Windows button control.
Definition button.h:49
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
Represents a common dialog box that displays input dialog.
Definition input_dialog.h:38
xtd::string text() const noexcept
Gets the dialog caption text.
Represents a standard Windows label.
Definition label.h:38
@ button1
The first button on the message box is the default button.
@ text
The xtd::forms::status_bar_panel displays text in the standard font.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
Examples
The following code example demonstrates the use of input_dialog dialog with multiline.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/input_dialog>
#include <xtd/forms/label>
using namespace xtd;
using namespace xtd::forms;
namespace input_dialog_multiline_example {
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.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;
};
}
auto main() -> int {
application::run(input_dialog_multiline_example::form1 {});
}
xtd::forms::dialog_result show_dialog()
Runs a common dialog box with a default owner.
bool multiline() const noexcept
Gets multiline status.
xtd::string value() const noexcept
Gets the value.
bool word_wrap() const noexcept
Gets word wrap status.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Examples
The following code example demonstrates the use of input_dialog dialog with password.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/input_dialog>
#include <xtd/forms/label>
using namespace xtd;
using namespace xtd::forms;
namespace input_dialog_password_example {
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.text("User password");
input_dialog.message("user: admin");
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;
};
}
auto main() -> int {
application::run(input_dialog_password_example::form1 {});
}
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs a common dialog box with the specified owner.
xtd::string message() const noexcept
Gets the text message.
bool use_system_password_char() const noexcept
Gets use system password char status.
Examples
input_dialog.cpp, input_dialog_multiline.cpp, and input_dialog_password.cpp.

Public Constructors

 input_dialog ()
 Initializes a new instance of the input_dialog class.
 

Public Properties

xtd::forms::character_casing character_casing () const noexcept
 Gets the character casing.
 
input_dialogcharacter_casing (xtd::forms::character_casing character_casing)
 Sets the character casing.
 
xtd::forms::dialog_appearance dialog_appearance () const noexcept
 Gets the dialog appearance.
 
input_dialogdialog_appearance (xtd::forms::dialog_appearance dialog_appearance)
 Sets the dialog appearance.
 
bool multiline () const noexcept
 Gets multiline status.
 
input_dialogmultiline (bool multiline)
 Sets multiline status.
 
xtd::string message () const noexcept
 Gets the text message.
 
input_dialogmessage (const xtd::string &message)
 Sets the text message.
 
xtd::string text () const noexcept
 Gets the dialog caption text.
 
input_dialogtext (const xtd::string &text)
 Sets the dialog caption text.
 
bool use_system_password_char () const noexcept
 Gets use system password char status.
 
input_dialoguse_system_password_char (bool use_system_password_char)
 Sets use system password char status.
 
xtd::string value () const noexcept
 Gets the value.
 
input_dialogvalue (const xtd::string &value)
 Sets the value.
 
bool word_wrap () const noexcept
 Gets word wrap status.
 
input_dialogword_wrap (bool word_wrap)
 Sets word wrap status.
 

Public Methods

void reset () noexcept override
 Resets all properties to empty string.
 

Protected Methods

bool run_dialog (intptr owner) override
 When overridden in a derived class, specifies a common dialog box.
 
void run_sheet (intptr owner) override
 When overridden in a derived class, specifies a common dialog box.
 

Additional Inherited Members

- Public Attributes inherited from xtd::forms::common_dialog
event< common_dialog, help_event_handlerhelp_request
 Occurs when the user clicks the Help button on a common dialog box.
 
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.
 
- Public Member Functions inherited from xtd::forms::common_dialog
 common_dialog ()
 Initializes a new instance of the common_dialog class.
 
xtd::forms::dialog_result dialog_result () const noexcept
 Gets async dialog_result result after dialog box is closing.
 
std::any tag () const noexcept
 Gets an object that contains data about the control.
 
common_dialogtag (const std::any &tag)
 Sets an object that contains data about the control.
 
xtd::forms::dialog_result show_dialog ()
 Runs a common dialog box with a default owner.
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner.
 
void show_sheet (const iwin32_window &owner)
 Runs a common dialog box with the specified owner.
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs a common dialog box with the specified owner.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const noexcept
 Returns a xtd::string that represents the current object.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
- 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.
 
virtual void on_help_request (help_event_args &e)
 Raises the common_dialog::help_request event.
 
void set_dialog_result (xtd::forms::dialog_result value)
 Sets async dialog_result result after dialog box is closing.
 
- Protected Member Functions inherited from xtd::forms::component
 component ()
 Initialises a new instance of the component class.
 
virtual bool can_raise_events () const noexcept
 Gets a value indicating whether the component can raise an event.
 
bool design_mode () const noexcept
 Gets a value that indicates whether the component is currently in design mode.
 

Constructor & Destructor Documentation

◆ input_dialog()

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

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
noexcept

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)

Sets the character casing.

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

◆ dialog_appearance() [1/2]

xtd::forms::dialog_appearance xtd::forms::input_dialog::dialog_appearance ( ) const
noexcept

Gets the dialog appearance.

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

◆ dialog_appearance() [2/2]

input_dialog & xtd::forms::input_dialog::dialog_appearance ( xtd::forms::dialog_appearance  dialog_appearance)

Sets the dialog appearance.

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

◆ multiline() [1/2]

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

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)

Sets multiline status.

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

◆ message() [1/2]

xtd::string xtd::forms::input_dialog::message ( ) const
noexcept

Gets the text message.

Returns
The text message.
Examples
input_dialog_password.cpp.

◆ message() [2/2]

input_dialog & xtd::forms::input_dialog::message ( const xtd::string message)

Sets the text message.

Parameters
messageThe text message.
Returns
Current input_dialog instance.

◆ text() [1/2]

xtd::string xtd::forms::input_dialog::text ( ) const
noexcept

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::string text)

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
noexcept

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)

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::string xtd::forms::input_dialog::value ( ) const
noexcept

Gets the value.

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

◆ value() [2/2]

input_dialog & xtd::forms::input_dialog::value ( const xtd::string value)

Sets the value.

Parameters
valueThe value.
Returns
Current input_dialog instance.

◆ word_wrap() [1/2]

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

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)

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.

◆ reset()

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

Resets all properties to empty string.

Implements xtd::forms::common_dialog.

◆ run_dialog()

bool xtd::forms::input_dialog::run_dialog ( intptr  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  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.


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