xtd.forms - Reference Guide  0.1.0
Modern c++17 library containing classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows, Apple macOS and Linux like Ubuntu operating system.
xtd::forms::input_box Class Reference

Represents a common dialog box that displays input box. More...

#include <input_box.h>

Inheritance diagram for xtd::forms::input_box:
xtd::forms::common_dialog xtd::forms::component

Public Member Functions

 input_box ()=default
 Initializes a new instance of the input_box class. More...
 
std::string caption () const
 Gets the caption. More...
 
input_boxcaption (const std::string &caption)
 Sets the caption. More...
 
bool multiline () const
 
void multiline (bool multiline)
 
void reset () override
 Resets all properties to empty string. More...
 
std::string text () const
 Gets the text message. More...
 
input_boxtext (const std::string &text)
 Sets the text message. More...
 
bool use_system_password_char () const
 
void use_system_password_char (bool use_system_password_char)
 
std::string value () const
 Gets the value. More...
 
input_boxvalue (const std::string &value)
 Sets thevalue. 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 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...
 
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...
 

Protected Member Functions

bool run_dialog (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_help_request (help_event_args &e)
 Raises the help_request event. More...
 
- Protected Member Functions inherited from xtd::forms::component
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...
 

Protected Attributes

std::string caption_
 
bool multiline_ = false
 
std::string text_
 
bool use_system_password_char_ = false
 
std::string value_
 

Additional Inherited Members

- Public Attributes inherited from xtd::forms::common_dialog
event< common_dialog, help_event_handler< component & > > help_request
 Occurs when the user clicks the Help button on a common dialog box. More...
 

Detailed Description

Represents a common dialog box that displays input box.

Example
The following code example demonstrate the use of input_box dialog.
#include <xtd/xtd.forms>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
text("Input box example");
controls().push_back_range({button1, label1});
button1.location({10, 10});
button1.text("Text...");
button1.click += [&] {
input_box.caption("Caption text");
input_box.text("Message text");
input_box.value(label1.text());
if (input_box.show_dialog() == dialog_result::ok)
label1.text(input_box.value());
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("Default value");
}
private:
label label1;
};
}
int main() {
application::run(examples::form1());
}

Constructor & Destructor Documentation

§ input_box()

xtd::forms::input_box::input_box ( )
default

Initializes a new instance of the input_box class.

Member Function Documentation

§ caption() [1/2]

std::string xtd::forms::input_box::caption ( ) const
inline

Gets the caption.

Returns
The product name.

§ caption() [2/2]

input_box& xtd::forms::input_box::caption ( const std::string &  caption)
inline

Sets the caption.

Parameters
captionThe caption.
Returns
Current input_box instance.

§ reset()

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

Resets all properties to empty string.

Implements xtd::forms::common_dialog.

§ run_dialog()

bool xtd::forms::input_box::run_dialog ( intptr_t  owner)
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.

§ text() [1/2]

std::string xtd::forms::input_box::text ( ) const
inline

Gets the text message.

Returns
The text message.

§ text() [2/2]

input_box& xtd::forms::input_box::text ( const std::string &  text)
inline

Sets the text message.

Parameters
textThe text message.
Returns
Current input_box instance.

§ value() [1/2]

std::string xtd::forms::input_box::value ( ) const
inline

Gets the value.

Returns
The value.

§ value() [2/2]

input_box& xtd::forms::input_box::value ( const std::string &  value)
inline

Sets thevalue.

Parameters
valueThe value.
Returns
Current input_box instance.

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