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

#include <exception_dialog.h>

Definition

Represents a common dialog box that displays exception dialog.

Namespace
xtd::forms
Library
xtd.forms
Examples
The following code example demonstrate the use of exception_dialog dialog.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Exception dialog example");
controls().push_back(button1);
button1.location({10, 10});
button1.auto_size(true);
button1.text("Exception...");
button1.click += [&] {
try{
throw invalid_operation_exception("Throws an invalid operation exception to show an exception dialog.", current_stack_frame_);
} catch(const xtd::system_exception& e) {
dialog.exception(e);
if (dialog.show_sheet_dialog(*this) == dialog_result::cancel)
}
};
}
private:
};
int main() {
application::run(form1());
}
static void exit()
Informs all message pumps that they must terminate, and then closes all application windows after the...
static void run()
Begins running a standard application message loop on the current thread, without a form.
xtd::ustring text() const
Gets the dialog caption text.
Definition: exception_dialog.h:64
exception_dialog()=default
Initializes a new instance of the exception_dialog class.
Defines the base class for predefined exceptions in the xtd namespace.
Definition: system_exception.h:24
#define current_stack_frame_
Provides information about the current stack frame.
Definition: stack_frame.h:201
@ cancel
The dialog box return value is Cancel (usually sent from a button labeled Cancel).
@ button1
The first button on the message box is the default button.
@ button
The appearance of a button.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17

Inherits xtd::forms::component.

Public Attributes

event< exception_dialog, dialog_closed_event_handlerdialog_closed
 Occurs when the user close an exception dialog box with dialog close button or other dialog buttons. More...
 

Public Member Functions

 exception_dialog ()=default
 Initializes a new instance of the exception_dialog class. More...
 
xtd::forms::dialog_result dialog_result () const
 Get async dialog_result result after dialog box is closing. More...
 
xtd::forms::dialog_style dialog_style () const
 Gets the dialog style. More...
 
exception_dialogdialog_style (xtd::forms::dialog_style dialog_style)
 Sets the dialog style. More...
 
std::reference_wrapper< const std::exception > exception () const
 Gets exception reference. More...
 
exception_dialogexception (const std::exception &exception)
 Sets exception. More...
 
void reset ()
 Resets all properties to empty string. More...
 
xtd::forms::dialog_result show_dialog ()
 Runs exception dialog box. More...
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs exception dialog box. More...
 
void show_sheet (const iwin32_window &owner)
 Runs exception dialog box. More...
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs exception dialog box. More...
 
xtd::ustring text () const
 Gets the dialog caption text. More...
 
exception_dialogtext (const xtd::ustring &text)
 Sets the dialog caption text. 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

void on_dialog_closed (const dialog_closed_event_args &e)
 Raises the close 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

- 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

◆ exception_dialog()

xtd::forms::exception_dialog::exception_dialog ( )
default

Initializes a new instance of the exception_dialog class.

Member Function Documentation

◆ dialog_result()

xtd::forms::dialog_result xtd::forms::exception_dialog::dialog_result ( ) const
inline

Get async dialog_result result after dialog box is closing.

Returns
ok if the user clicks OK in the dialog box; otherwise, cancel.

◆ dialog_style() [1/2]

xtd::forms::dialog_style xtd::forms::exception_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]

exception_dialog& xtd::forms::exception_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 exception_dialog instance.

◆ exception() [1/2]

std::reference_wrapper<const std::exception> xtd::forms::exception_dialog::exception ( ) const
inline

Gets exception reference.

Returns
A exception reference.

◆ exception() [2/2]

exception_dialog& xtd::forms::exception_dialog::exception ( const std::exception &  exception)
inline

Sets exception.

Parameters
exceptionThe exception.
Returns
Current exception_dialog instance.
Warning
Contains only a reference on the parameter exception. Do not delete exception before closing dialog.

◆ on_dialog_closed()

void xtd::forms::exception_dialog::on_dialog_closed ( const dialog_closed_event_args e)
inlineprotected

Raises the close event.

Parameters
eAn exception_dialog_closed_event_args that provides the event data.
Remarks
This method is invoked when the exception dialog box is closed.

◆ reset()

void xtd::forms::exception_dialog::reset ( )

Resets all properties to empty string.

◆ show_dialog() [1/2]

xtd::forms::dialog_result xtd::forms::exception_dialog::show_dialog ( )

Runs exception dialog box.

◆ show_dialog() [2/2]

xtd::forms::dialog_result xtd::forms::exception_dialog::show_dialog ( const iwin32_window owner)

Runs exception dialog box.

◆ show_sheet()

void xtd::forms::exception_dialog::show_sheet ( const iwin32_window owner)

Runs exception dialog box.

Remarks
The result will done in async. Check result_dialog property after dialog box closed to obtain the result.

◆ show_sheet_dialog()

xtd::forms::dialog_result xtd::forms::exception_dialog::show_sheet_dialog ( const iwin32_window owner)

Runs exception dialog box.

◆ text() [1/2]

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

Gets the dialog caption text.

Returns
The current dialog caption text.

◆ text() [2/2]

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

Sets the dialog caption text.

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

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