xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
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)
application::exit();
}
};
}
private:
};
int main() {
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:54
Represents a common dialog box that displays exception dialog.
Definition: exception_dialog.h:30
std::reference_wrapper< const std::exception > exception() const
Gets exception reference.
Definition: exception_dialog.h:52
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs exception dialog box.
Represents a window or dialog box that makes up an application's user interface.
Definition: form.h:40
The exception that is thrown when a method call is invalid for the object's current state.
Definition: invalid_operation_exception.h:18
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
@ button1
The first button on the message box is the default 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
Examples
exception_dialog.cpp.

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.
 

Public Member Functions

 exception_dialog ()=default
 Initializes a new instance of the exception_dialog class.
 
xtd::forms::dialog_result dialog_result () const
 Get async dialog_result result after dialog box is closing.
 
xtd::forms::dialog_style dialog_style () const
 Gets the dialog style.
 
exception_dialogdialog_style (xtd::forms::dialog_style dialog_style)
 Sets the dialog style.
 
std::reference_wrapper< const std::exception > exception () const
 Gets exception reference.
 
exception_dialogexception (const std::exception &exception)
 Sets exception.
 
void reset ()
 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.
 
xtd::ustring text () const
 Gets the dialog caption text.
 
exception_dialogtext (const xtd::ustring &text)
 Sets the dialog caption text.
 
- 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.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance.
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object.
 

Protected Member Functions

void on_dialog_closed (const dialog_closed_event_args &e)
 Raises the close event.
 
- Protected Member Functions inherited from xtd::forms::component
 component ()=default
 Initialises a new instance of the component class.
 
virtual bool can_raise_events () const
 Gets a value indicating whether the component can raise an event.
 
bool design_mode () const
 Gets a value that indicates whether the component is currently in design mode.
 

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.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

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.
Examples
exception_dialog.cpp.

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

Examples
exception_dialog.cpp.

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