xtd 1.0.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/xtd>
namespace input_dialog_example {
class form1 : public form {
public:
form1() {
text("Input dialog example");
controls().add_range({button1, label1});
button1.location({10, 10});
button1.text("Text...");
button1.click += delegate_ {
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 {});
}
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
auto text() const noexcept -> xtd::string
Gets the dialog caption text.
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:1018
xtd::forms::style_sheets::control label
The label data allows you to specify the box of a label control.
Definition label.hpp:25
xtd::forms::style_sheets::control button
The buttton data allows you to specify the box of a button control.
Definition button.hpp:25
@ button1
The first button on the message box is the default button.
Definition message_dialog_default_button.hpp:24
Examples
The following code example demonstrates the use of input_dialog dialog with multiline.
#include <xtd/xtd>
namespace input_dialog_multiline_example {
class form1 : public form {
public:
form1() {
auto_scroll(true);
text("Input dialog multiline example");
controls().add_range({button1, label1});
button1.location({10, 10});
button1.auto_size(true);
button1.text("Lines...");
button1.click += delegate_ {
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;
};
}
auto main() -> int {
application::run(input_dialog_multiline_example::form1 {});
}
Examples
The following code example demonstrates the use of input_dialog dialog with password.
#include <xtd/xtd>
namespace input_dialog_password_example {
class form1 : public form {
public:
form1() {
text("Input dialog password example");
controls().add_range({button1, label1});
button1.location({10, 10});
button1.auto_size(true);
button1.text("Password...");
button1.click += delegate_ {
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;
};
}
auto main() -> int {
application::run(input_dialog_password_example::form1 {});
}

Public Constructors

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

Public Properties

auto character_casing () const noexcept -> xtd::forms::character_casing
 Gets the character casing.
auto character_casing (xtd::forms::character_casing value) -> input_dialog &
 Sets the character casing.
auto dialog_appearance () const noexcept -> xtd::forms::dialog_appearance
 Gets the dialog appearance.
auto dialog_appearance (xtd::forms::dialog_appearance value) -> input_dialog &
 Sets the dialog appearance.
auto multiline () const noexcept -> bool
 Gets multiline status.
auto multiline (bool value) -> input_dialog &
 Sets multiline status.
auto message () const noexcept -> xtd::string
 Gets the text message.
auto message (const xtd::string &value) -> input_dialog &
 Sets the text message.
auto text () const noexcept -> xtd::string
 Gets the dialog caption text.
auto text (const xtd::string &value) -> input_dialog &
 Sets the dialog caption text.
auto use_system_password_char () const noexcept -> bool
 Gets use system password char status.
auto use_system_password_char (bool value) -> input_dialog &
 Sets use system password char status.
auto value () const noexcept -> xtd::string
 Gets the value.
auto value (const xtd::string &value) -> input_dialog &
 Sets the value.
auto word_wrap () const noexcept -> bool
 Gets word wrap status.
auto word_wrap (bool value) -> input_dialog &
 Sets word wrap status.

Public Methods

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

Protected Methods

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

Additional Inherited Members

xtd::event< common_dialog, xtd::forms::help_event_handlerhelp_request
 Occurs when the user clicks the Help button on a common dialog box.
xtd::event< common_dialog, xtd::forms::dialog_closed_event_handlerdialog_closed
 Occurs when the user close a common dialog box with dialog close button or other dialog buttons.
 common_dialog ()
 Initializes a new instance of the common_dialog class.
auto dialog_result () const noexcept -> xtd::forms::dialog_result
 Gets async dialog_result result after dialog box is closing.
auto tag () const noexcept -> const xtd::any_object &
 Gets an object that contains data about the control.
auto tag (const xtd::any_object &value) -> common_dialog &
 Sets an object that contains data about the control.
auto show_dialog () -> xtd::forms::dialog_result
 Runs a common dialog box with a default owner.
auto show_dialog (const iwin32_window &owner) -> xtd::forms::dialog_result
 Runs a common dialog box with the specified owner.
auto show_sheet (const iwin32_window &owner) -> void
 Runs a common dialog box with the specified owner.
auto show_sheet_dialog (const iwin32_window &owner) -> xtd::forms::dialog_result
 Runs a common dialog box with the specified owner.
 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto equals (const object &obj) const noexcept -> bool
 Determines whether the specified object is equal to the current object.
virtual auto get_hash_code () const noexcept -> xtd::usize
 Serves as a hash function for a particular type.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
virtual auto to_string () const -> xtd::string
 Returns a xtd::string that represents the current object.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are the same instance.
virtual auto on_dialog_closed (const xtd::forms::dialog_closed_event_args &e) -> void
 Raises the common_dialog::dialog_close event.
virtual auto on_help_request (xtd::forms::help_event_args &e) -> void
 Raises the common_dialog::help_request event.
auto set_dialog_result (xtd::forms::dialog_result value) -> void
 Sets async dialog_result result after dialog box is closing.
 component ()
 Initialises a new instance of the component class.
virtual auto can_raise_events () const noexcept -> bool
 Gets a value indicating whether the component can raise an event.
auto design_mode () const noexcept -> bool
 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]

auto xtd::forms::input_dialog::character_casing ( ) const -> xtd::forms::character_casing
nodiscardnoexcept

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]

auto xtd::forms::input_dialog::character_casing ( xtd::forms::character_casing value) -> input_dialog &

Sets the character casing.

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

◆ dialog_appearance() [1/2]

auto xtd::forms::input_dialog::dialog_appearance ( ) const -> xtd::forms::dialog_appearance
nodiscardnoexcept

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]

auto xtd::forms::input_dialog::dialog_appearance ( xtd::forms::dialog_appearance value) -> input_dialog &

Sets the dialog appearance.

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

◆ multiline() [1/2]

auto xtd::forms::input_dialog::multiline ( ) const -> bool
nodiscardnoexcept

Gets multiline status.

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

◆ multiline() [2/2]

auto xtd::forms::input_dialog::multiline ( bool value) -> input_dialog &

Sets multiline status.

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

◆ message() [1/2]

auto xtd::forms::input_dialog::message ( ) const -> xtd::string
nodiscardnoexcept

Gets the text message.

Returns
The text message.

◆ message() [2/2]

auto xtd::forms::input_dialog::message ( const xtd::string & value) -> input_dialog &

Sets the text message.

Parameters
valueThe text message.
Returns
Current input_dialog instance.

◆ text() [1/2]

auto xtd::forms::input_dialog::text ( ) const -> xtd::string
nodiscardnoexcept

Gets the dialog caption text.

Returns
The current dialog caption text.

◆ text() [2/2]

auto xtd::forms::input_dialog::text ( const xtd::string & value) -> input_dialog &

Sets the dialog caption text.

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

◆ use_system_password_char() [1/2]

auto xtd::forms::input_dialog::use_system_password_char ( ) const -> bool
nodiscardnoexcept

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.

◆ use_system_password_char() [2/2]

auto xtd::forms::input_dialog::use_system_password_char ( bool value) -> input_dialog &

Sets use system password char status.

Parameters
valuetrue 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]

auto xtd::forms::input_dialog::value ( ) const -> xtd::string
nodiscardnoexcept

Gets the value.

Returns
The value.

◆ value() [2/2]

auto xtd::forms::input_dialog::value ( const xtd::string & value) -> input_dialog &

Sets the value.

Parameters
valueThe value.
Returns
Current input_dialog instance.

◆ word_wrap() [1/2]

auto xtd::forms::input_dialog::word_wrap ( ) const -> bool
nodiscardnoexcept

Gets word wrap status.

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

◆ word_wrap() [2/2]

auto xtd::forms::input_dialog::word_wrap ( bool value) -> input_dialog &

Sets word wrap status.

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

◆ reset()

auto xtd::forms::input_dialog::reset ( ) -> void
overridevirtualnoexcept

Resets all properties to empty string.

Implements xtd::forms::common_dialog.

◆ run_dialog()

auto xtd::forms::input_dialog::run_dialog ( xtd::intptr owner) -> bool
overrideprotectedvirtual

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

Parameters
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()

auto xtd::forms::input_dialog::run_sheet ( xtd::intptr owner) -> void
overrideprotectedvirtual

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

Parameters
ownerA value that represents the window handle of the owner window for the common dialog box.

Implements xtd::forms::common_dialog.


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