xtd 1.0.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/xtd>
class form1 : public form {
public:
form1() {
text("Exception dialog example");
controls().add(button1);
button1.location({10, 10});
button1.auto_size(true);
button1.text("Exception...");
button1.click += delegate_ {
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)
}
};
}
private:
};
auto main() -> int {
application::run(form1 {});
}
static auto exit() -> void
Informs all message pumps that they must terminate, and then closes all application windows after the...
virtual auto text() const noexcept -> const xtd::string &
Gets the text associated with this control.
virtual auto controls() noexcept -> control_collection &
Gets the collection of controls contained within the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
The exception that is thrown when the format of an argument does not meet the parameter specification...
Definition invalid_operation_exception.hpp:18
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.hpp:18
#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 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

Public Events

xtd::event< exception_dialog, xtd::forms::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

auto dialog_result () const noexcept -> xtd::forms::dialog_result
 Gets async dialog_result result after dialog box is closing.
auto dialog_appearance () const noexcept -> xtd::forms::dialog_appearance
 Gets the dialog appearance.
auto dialog_appearance (xtd::forms::dialog_appearance dialog_appearancedialog_appearance) -> exception_dialog &
 Sets the dialog appearance.
auto exception () const noexcept -> xtd::ref< const std::exception >
 Gets exception reference.
auto exception (const std::exception &exception) -> exception_dialog &
 Sets exception.
auto text () const noexcept -> xtd::string
 Gets the dialog caption text.
auto text (const xtd::string &text) -> exception_dialog &
 Sets the dialog caption text.

Public Methods

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

Protected Methods

auto on_dialog_closed (const xtd::forms::dialog_closed_event_args &e) -> void
 Raises the close event.

Additional Inherited Members

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

◆ exception_dialog()

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

Initializes a new instance of the exception_dialog class.

Member Function Documentation

◆ dialog_result()

auto xtd::forms::exception_dialog::dialog_result ( ) const -> xtd::forms::dialog_result
nodiscardnoexcept

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]

auto xtd::forms::exception_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::exception_dialog::dialog_appearance ( xtd::forms::dialog_appearance dialog_appearance) -> exception_dialog &

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]

auto xtd::forms::exception_dialog::exception ( ) const -> xtd::ref< const std::exception >
nodiscardnoexcept

Gets exception reference.

Returns
A exception reference.

◆ exception() [2/2]

auto xtd::forms::exception_dialog::exception ( const std::exception & exception) -> exception_dialog &

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]

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

Gets the dialog caption text.

Returns
The current dialog caption text.

◆ text() [2/2]

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

Sets the dialog caption text.

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

◆ reset()

auto xtd::forms::exception_dialog::reset ( ) -> void
noexcept

Resets all properties to empty string.

◆ show_dialog() [1/2]

auto xtd::forms::exception_dialog::show_dialog ( ) -> xtd::forms::dialog_result

Runs exception dialog box.

◆ show_dialog() [2/2]

auto xtd::forms::exception_dialog::show_dialog ( const xtd::forms::iwin32_window & owner) -> xtd::forms::dialog_result

Runs exception dialog box.

◆ show_sheet()

auto xtd::forms::exception_dialog::show_sheet ( const xtd::forms::iwin32_window & owner) -> void

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

auto xtd::forms::exception_dialog::show_sheet_dialog ( const xtd::forms::iwin32_window & owner) -> xtd::forms::dialog_result

Runs exception dialog box.

◆ on_dialog_closed()

auto xtd::forms::exception_dialog::on_dialog_closed ( const xtd::forms::dialog_closed_event_args & e) -> void
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

xtd::event<exception_dialog, xtd::forms::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: