xtd 0.2.0
Loading...
Searching...
No Matches
xtd::forms::exception_dialog Class Referencefinal
Inheritance diagram for xtd::forms::exception_dialog:
xtd::forms::component xtd::object

Definition

Represents a common dialog box that displays exception dialog.

Header
#include <xtd/forms/exception_dialog>
Namespace
xtd::forms
Library
xtd.forms
Appearance
Windows macOS Gnome
Light  
 
 
 
 
 
Dark  
 
 
 
 
 
Examples
The following code example demonstrates the use of exception_dialog dialog.
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/exception_dialog>
#include <xtd/forms/form>
#include <xtd/invalid_operation_exception>
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.");
} catch (const xtd::system_exception& e) {
auto dialog = exception_dialog {};
dialog.exception(e);
if (dialog.show_sheet_dialog(*this) == dialog_result::cancel)
application::exit();
}
};
}
private:
};
auto main() -> int {
application::run(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 common dialog box that displays exception dialog.
Definition exception_dialog.h:38
std::reference_wrapper< const std::exception > exception() const noexcept
Gets exception reference.
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
The exception that is thrown when the format of an argument does not meet the parameter specification...
Definition invalid_operation_exception.h:19
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.h:18
@ 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
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Examples
exception_dialog.cpp.

Public Events

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.
 

Public Constructors

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

Public Properties

xtd::forms::dialog_result dialog_result () const noexcept
 Gets async dialog_result result after dialog box is closing.
 
xtd::forms::dialog_appearance dialog_appearance () const noexcept
 Gets the dialog appearance.
 
exception_dialogdialog_appearance (xtd::forms::dialog_appearance dialog_appearance)
 Sets the dialog appearance.
 
std::reference_wrapper< const std::exception > exception () const noexcept
 Gets exception reference.
 
exception_dialogexception (const std::exception &exception)
 Sets exception.
 
xtd::string text () const noexcept
 Gets the dialog caption text.
 
exception_dialogtext (const xtd::string &text)
 Sets the dialog caption text.
 

Public Methods

void reset () noexcept
 Resets all properties to empty string.
 
xtd::forms::dialog_result show_dialog ()
 Runs exception dialog box.
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs exception dialog box.
 
void show_sheet (const iwin32_window &owner)
 Runs exception dialog box.
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs exception dialog box.
 

Protected Methods

void on_dialog_closed (const dialog_closed_event_args &e)
 Raises the close event.
 

Additional Inherited Members

- 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::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

◆ exception_dialog()

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

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
noexcept

Gets async dialog_result result after dialog box is closing.

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

◆ dialog_appearance() [1/2]

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

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

◆ exception() [1/2]

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

Gets exception reference.

Returns
A exception reference.
Examples
exception_dialog.cpp.

◆ exception() [2/2]

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

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.

◆ text() [1/2]

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

Gets the dialog caption text.

Returns
The current dialog caption text.

◆ text() [2/2]

exception_dialog & xtd::forms::exception_dialog::text ( const xtd::string text)

Sets the dialog caption text.

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

◆ reset()

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

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.

◆ on_dialog_closed()

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

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.

Member Data Documentation

◆ dialog_closed

event<exception_dialog, dialog_closed_event_handler> xtd::forms::exception_dialog::dialog_closed

Occurs when the user close an exception dialog box with dialog close button or other dialog buttons.

Remarks
For more information about handling events, see Handling and Raising Events.

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