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.
Classes | Typedefs | Functions | Variables
events

Definition

events are event args and event handler needed to response to window messages.

Classes

class  xtd::console_cancel_event_args
 Provides data for the console::cancel_key_press event. This class cannot be inherited. More...
 
class  xtd::diagnostics::data_received_event_args
 Provides data for the xtd::diagnostics::process::output_data_received and xtd::diagnostics::process::error_data_received events. More...
 
class  xtd::diagnostics::process::error_data_received_event
 Represents a process error data received event. More...
 
class  xtd::diagnostics::process::exit_event
 Represents a process exit event. More...
 
class  xtd::diagnostics::process::output_data_received_event
 Represents a process output data received event. More...
 
class  xtd::event< object_t, handler_t >
 Represents an event. More...
 
class  xtd::event_args
 Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data. More...
 
class  xtd::forms::animation_updated_event_args
 Provides data for the animation update event. More...
 
class  xtd::forms::cancel_event_args
 Provides data for a cancelable event. More...
 
class  xtd::forms::control_event_args
 Provides data for the control_added and control_removed events. More...
 
class  xtd::forms::dialog_closed_event_args
 Provides data for a dialog closed event. More...
 
class  xtd::forms::do_work_event_args
 Provides data for the do_work event handler. More...
 
class  xtd::forms::form_closed_event_args
 Provides data for the form_closed event. More...
 
class  xtd::forms::form_closing_event_args
 Provides data for the form_closing event. More...
 
class  xtd::forms::help_event_args
 Provides data for the control_added and control_removed events. More...
 
class  xtd::forms::item_check_event_args
 Provides data for the item_check event of the checked_list_box and list_view controls. More...
 
class  xtd::forms::key_event_args
 Provides data for the key_down or key_up event. More...
 
class  xtd::forms::key_press_event_args
 Provides data for the key_press event. More...
 
class  xtd::forms::mouse_event_args
 Provides data for the xtd::forms::control::mouse_up, xtd::forms::control::mouse_down, and xtd::forms::control::mouse_move events. More...
 
class  xtd::forms::paint_event_args
 Provides data for the paint event. More...
 
class  xtd::forms::progress_changed_event_args
 Provides data for the do_work event handler. More...
 
class  xtd::forms::run_worker_completed_event_args
 Provides data for the do_work event handler. More...
 
class  xtd::tunit::class_event_args
 Provides data for the xtd::tunit::class_test events. More...
 
class  xtd::tunit::test_event_args
 Provides data for the xtd::tunit::test events. More...
 
class  xtd::tunit::tunit_event_args
 tunit_event_args is the base class for classes containing event data. More...
 

Typedefs

using xtd::forms::animation_updated_event_handler = xtd::delegate< void(object &, const xtd::forms::animation_updated_event_args &)>
 Represents the method that will handle the update of xtd::forms::animation. More...
 
using xtd::forms::cancel_event_handler = delegate< void(object &sender, cancel_event_args &e)>
 Represents the method that handles a cancelable event. More...
 
using xtd::console_cancel_event_handler = xtd::delegate< void(console_cancel_event_args &)>
 Represents the method that will handle the cancel_key_press event of a xtd::console. More...
 
using xtd::forms::control_event_handler = delegate< void(object &sender, const control_event_args &e)>
 Represents the method that will handle the control_added and control_removed events of the control class. More...
 
using xtd::diagnostics::data_received_event_handler = xtd::delegate< void(object &sender, const xtd::diagnostics::data_received_event_args &e)>
 Represents the method that will handle the xtd::diagnostics::process::output_data_received and xtd::diagnostics::process::error_data_received event of a Process. More...
 
using xtd::forms::dialog_closed_event_handler = delegate< void(object &sender, const dialog_closed_event_args &e)>
 Provides handler for a dialog closed event. More...
 
using xtd::forms::do_work_event_handler = delegate< void(object &sender, do_work_event_args &e)>
 Represents the method that will handle the do_work event. This class cannot be inherited. More...
 
using xtd::event_handler = generic_event_handler<>
 Represents the method that will handle an event that has no event data. More...
 
using xtd::forms::form_closed_event_handler = delegate< void(object &sender, const form_closed_event_args &e)>
 Represents the method that handles a form_closed event. More...
 
using xtd::forms::form_closing_event_handler = delegate< void(object &sender, form_closing_event_args &e)>
 Represents the method that handles a form_closing event. More...
 
template<typename event_args_t = const event_args&>
using xtd::generic_event_handler = xtd::delegate< void(object &sender, event_args_t e)>
 Represents the method that will handle an event when the event provides data. More...
 
using xtd::forms::help_event_handler = delegate< void(object &sender, help_event_args &e)>
 Represents the method that will handle the help_requested event of a control. More...
 
using xtd::forms::item_check_event_handler = delegate< void(object &sender, item_check_event_args &e)>
 Represents the method that will handle the ItemCheck event of a CheckedListBox or ListView control. More...
 
using xtd::forms::key_event_handler = delegate< void(object &sender, key_event_args &e)>
 Represents the method that will handle the key_up or key_down event of a control. More...
 
using xtd::forms::key_press_event_handler = delegate< void(object &sender, key_press_event_args &e)>
 Represents the method that will handle the key_press event of a control. More...
 
using xtd::forms::message_loop_callback = delegate< bool()>
 Represents a method that will check whether the hosting environment is still sending messages. More...
 
using xtd::forms::mouse_event_handler = delegate< void(object &sender, const mouse_event_args &e)>
 Represents the method that will handle the MouseDown, MouseUp, or MouseMove event of a form, control, or other component. More...
 
using xtd::forms::paint_event_handler = delegate< void(object &sender, paint_event_args &e)>
 Represents the method that will handle the paint event of a control. More...
 
using xtd::forms::progress_changed_event_handler = delegate< void(object &sender, const progress_changed_event_args &e)>
 Represents the method that will handle the do_work event. This class cannot be inherited. More...
 
using xtd::forms::run_worker_completed_event_handler = delegate< void(object &sender, const run_worker_completed_event_args &e)>
 Represents the method that will handle the do_work event. This class cannot be inherited. More...
 

Functions

virtual void xtd::forms::control::on_auto_size_changed (const event_args &e)
 Raises the control::auto_size_changed event. More...
 
virtual void xtd::forms::control::on_back_color_changed (const event_args &e)
 Raises the control::back_color_changed event. More...
 
virtual void xtd::forms::control::on_background_image_changed (const event_args &e)
 Raises the control::background_image_changed event. More...
 
virtual void xtd::forms::control::on_background_image_layout_changed (const event_args &e)
 Raises the control::background_image_layout_changed event. More...
 
virtual void xtd::forms::control::on_click (const event_args &e)
 Raises the control::click event. More...
 
virtual void xtd::forms::control::on_client_size_changed (const event_args &e)
 Raises the control::client_size_changed event. More...
 
virtual void xtd::forms::control::on_control_added (const control_event_args &e)
 Raises the control::control_added event. More...
 
virtual void xtd::forms::control::on_control_removed (const control_event_args &e)
 Raises the control::control_removed event. More...
 
virtual void xtd::forms::control::on_create_control ()
 Raises the control::create_control event. More...
 
virtual void xtd::forms::control::on_cursor_changed (const event_args &e)
 Raises the control::cursor_changed event. More...
 
virtual void xtd::forms::control::on_dock_changed (const event_args &e)
 Raises the control::dock_changed event. More...
 
virtual void xtd::forms::control::on_double_click (const event_args &e)
 Raises the double_click event. More...
 
virtual void xtd::forms::control::on_enabled_changed (const event_args &e)
 Raises the control::enabled_changed event. More...
 
virtual void xtd::forms::control::on_font_changed (const event_args &e)
 Raises the control::font_changed event. More...
 
virtual void xtd::forms::control::on_fore_color_changed (const event_args &e)
 Raises the control::fore_color_changed event. More...
 
virtual void xtd::forms::control::on_got_focus (const event_args &e)
 Raises the control::got_focus event. More...
 
virtual void xtd::forms::control::on_handle_created (const event_args &e)
 Raises the control::handle_created event. More...
 
virtual void xtd::forms::control::on_handle_destroyed (const event_args &e)
 Raises the control::handle_destroyed event. More...
 
virtual void xtd::forms::control::on_key_down (key_event_args &e)
 Raises the control::key_down event. More...
 
virtual void xtd::forms::control::on_key_press (key_press_event_args &e)
 Raises the control::key_press event. More...
 
virtual void xtd::forms::control::on_key_up (key_event_args &e)
 Raises the control::key_up event. More...
 
virtual void xtd::forms::control::on_layout (const event_args &e)
 Raises the control::layout event. More...
 
virtual void xtd::forms::control::on_location_changed (const event_args &e)
 Raises the control::location_changed event. More...
 
virtual void xtd::forms::control::on_lost_focus (const event_args &e)
 Raises the control::lost_focus event. More...
 
virtual void xtd::forms::control::on_mouse_click (const mouse_event_args &e)
 Raises the control::mouse_click event. More...
 
virtual void xtd::forms::control::on_mouse_double_click (const mouse_event_args &e)
 Raises the control::mouse_double_click event. More...
 
virtual void xtd::forms::control::on_mouse_down (const mouse_event_args &e)
 Raises the control::mouse_down event. More...
 
virtual void xtd::forms::control::on_mouse_enter (const event_args &e)
 Raises the control::mouse_enter event. More...
 
virtual void xtd::forms::control::on_mouse_horizontal_wheel (const mouse_event_args &e)
 Raises the control::mouse_horizontal_wheel event. More...
 
virtual void xtd::forms::control::on_mouse_leave (const event_args &e)
 Raises the control::mouse_leave event. More...
 
virtual void xtd::forms::control::on_mouse_move (const mouse_event_args &e)
 Raises the control::mouse_move event. More...
 
virtual void xtd::forms::control::on_mouse_up (const mouse_event_args &e)
 Raises the control::mouse_up event. More...
 
virtual void xtd::forms::control::on_mouse_wheel (const mouse_event_args &e)
 Raises the control::mouse_wheel event. More...
 
virtual void xtd::forms::control::on_paint (paint_event_args &e)
 Raises the control::paint event. More...
 
virtual void xtd::forms::control::on_parent_back_color_changed (const event_args &e)
 Raises the control::parent_back_color_changed event. More...
 
virtual void xtd::forms::control::on_parent_changed (const event_args &e)
 Raises the control::parent_changed event. More...
 
virtual void xtd::forms::control::on_parent_cursor_changed (const event_args &e)
 Raises the control::parent_cursor_changed event. More...
 
virtual void xtd::forms::control::on_parent_enabled_changed (const event_args &e)
 Raises the xtd::control::enabled_changed event when the xtd::control::enabled property value of the control's container changes.. More...
 
virtual void xtd::forms::control::on_parent_font_changed (const event_args &e)
 Raises the control::parent_font_changed event. More...
 
virtual void xtd::forms::control::on_parent_fore_color_changed (const event_args &e)
 Raises the control::parent_fore_color_changed event. More...
 
virtual void xtd::forms::control::on_resize (const event_args &e)
 Raises the control::resize event. More...
 
virtual void xtd::forms::control::on_size_changed (const event_args &e)
 Raises the control::size_changed event. More...
 
virtual void xtd::forms::control::on_text_changed (const event_args &e)
 Raises the control::text_changed event. More...
 
virtual void xtd::forms::control::on_visible_changed (const event_args &e)
 Raises the control::visible_changed event. More...
 

Variables

event< text_box, event_handlerxtd::forms::text_box::accepts_return_changed
 Occurs when the value of the accepts_return property has changed. More...
 
event< text_box_base, event_handlerxtd::forms::text_box_base::accepts_tab_changed
 Occurs when the value of the accepts_tab property has changed. More...
 
event< form, event_handlerxtd::forms::form::activated
 Occurs when the form is activated in code or by the user. More...
 
event< check_box, event_handlerxtd::forms::check_box::appearance_changed
 Occurs when the value of the appearance property changes. More...
 
event< radio_button, event_handlerxtd::forms::radio_button::appearance_changed
 Occurs when the appearance property value changes. More...
 
static event< application, delegate< void(const event_args &)> > xtd::forms::application::application_exit
 Occurs when the application is about to shut down. More...
 
event< font_dialog, event_handlerxtd::forms::font_dialog::apply
 Occurs when the user clicks the Apply button in the font dialog box. More...
 
event< control, event_handlerxtd::forms::control::auto_size_changed
 Occurs when the value of the auto_size property changes. More...
 
event< control, event_handlerxtd::forms::control::back_color_changed
 Occurs when the value of the back_color property changes. More...
 
event< control, event_handlerxtd::forms::control::background_image_changed
 Occurs when the value of the background_image property changes. More...
 
event< control, event_handlerxtd::forms::control::background_image_layout_changed
 Occurs when the value of the background_image_layout property changes. More...
 
event< text_box_base, event_handlerxtd::forms::text_box_base::border_style_changed
 Occurs when the value of the accepts_tab border_style has changed. More...
 
event< check_box, event_handlerxtd::forms::check_box::check_state_changed
 Occurs when the value of the check_state property changes. More...
 
event< toggle_button, event_handlerxtd::forms::toggle_button::check_state_changed
 Occurs when the value of the check_state property changes. More...
 
event< check_box, event_handlerxtd::forms::check_box::checked_changed
 Occurs when the value of the checked property changes. More...
 
event< radio_button, event_handlerxtd::forms::radio_button::checked_changed
 Occurs when the value of the checked property changes. More...
 
event< switch_button, event_handlerxtd::forms::switch_button::checked_changed
 Occurs when the value of the checked property changes. More...
 
event< toggle_button, event_handlerxtd::forms::toggle_button::checked_changed
 Occurs when the value of the checked property changes. More...
 
event< control, event_handlerxtd::forms::control::click
 Occurs when the control is clicked. More...
 
event< control, event_handlerxtd::forms::control::client_size_changed
 Occurs when the value of the client_size property changes. More...
 
event< color_picker, event_handlerxtd::forms::color_picker::color_changed
 Occurs when the value of the color property changes. More...
 
event< control, control_event_handlerxtd::forms::control::control_added
 Occurs when a new control is added to the control::control_collection. More...
 
event< control, control_event_handlerxtd::forms::control::control_removed
 Occurs when a new control is removed to the control::control_collection. More...
 
event< control, event_handlerxtd::forms::control::cursor_changed
 Occurs when the value of the cursor property changes. More...
 
event< form, event_handlerxtd::forms::form::deactivate
 Occurs when the form loses focus and is no longer the active form. More...
 
event< common_dialog, dialog_closed_event_handlerxtd::forms::common_dialog::dialog_closed
 Occurs when the user close a common dialog box with dialog close button or other dialog buttons. More...
 
event< exception_dialog, dialog_closed_event_handlerxtd::forms::exception_dialog::dialog_closed
 Occurs when the user close an exception dialog box with dialog close button or other dialog buttons. More...
 
event< message_dialog, dialog_closed_event_handlerxtd::forms::message_dialog::dialog_closed
 Occurs when the user close a message dialog box with dialog close button or other dialog buttons. More...
 
event< background_worker, do_work_event_handlerxtd::forms::background_worker::do_work
 Occurs when run_worker_async() is called. More...
 
event< control, event_handlerxtd::forms::control::dock_changed
 Occurs when the value of the dock property changes. More...
 
event< control, event_handlerxtd::forms::control::double_click
 Occurs when the control is double-clicked. More...
 
event< combo_box, event_handlerxtd::forms::combo_box::drop_down_style_changed
 Occurs when the drop_down_style property has changed. More...
 
event< control, event_handlerxtd::forms::control::enabled_changed
 Occurs when the value of the enabled property changes. More...
 
static event< application, delegate< void(const event_args &)> > xtd::forms::application::enter_thread_modal
 Occurs when the application is about to enter a modal state. More...
 
xtd::event< collapsible_panel, xtd::event_handlerxtd::forms::collapsible_panel::expanded_changed
 Occurs when the expanded property changes. More...
 
event< control, event_handlerxtd::forms::control::font_changed
 Occurs when the value of the font property changes. More...
 
event< font_picker, event_handlerxtd::forms::font_picker::font_changed
 Occurs when the value of the font property changes. More...
 
event< control, event_handlerxtd::forms::control::fore_color_changed
 Occurs when the value of the fore_color property changes. More...
 
event< form, form_closed_event_handlerxtd::forms::form::form_closed
 Occurs after the form is closed. More...
 
event< form, form_closing_event_handlerxtd::forms::form::form_closing
 Occurs before the form is closed. More...
 
event< control, event_handlerxtd::forms::control::got_focus
 Occurs when the control receives focus. More...
 
event< control, event_handlerxtd::forms::control::handle_created
 Occurs when a handle is created for the control. More...
 
event< control, event_handlerxtd::forms::control::handle_destroyed
 Occurs when the control's handle is in the process of being destroyed. More...
 
event< common_dialog, help_event_handlerxtd::forms::common_dialog::help_request
 Occurs when the user clicks the Help button on a common dialog box. More...
 
event< message_dialog, help_event_handlerxtd::forms::message_dialog::help_request
 Occurs when the user clicks the Help button on a common dialog box. More...
 
static event< application, delegate< void(const event_args &)> > xtd::forms::application::idle
 Occurs when the application finishes processing and is about to enter the idle state. More...
 
event< button_base, event_handlerxtd::forms::button_base::image_changed
 Occurs when the value of the image property changes. More...
 
event< control, key_event_handlerxtd::forms::control::key_down
 Occurs when a key is pressed while the control has focus. More...
 
event< control, key_press_event_handlerxtd::forms::control::key_press
 Occurs when a character. space or backspace key is pressed while the control has focus. More...
 
event< control, key_event_handlerxtd::forms::control::key_up
 Occurs when a key is released while the control has focus. More...
 
event< control, event_handlerxtd::forms::control::layout
 Occurs when a control should reposition its child controls. More...
 
static event< application, delegate< void(const event_args &)> > xtd::forms::application::leave_thread_modal
 Occurs when the application is about to leave a modal state. More...
 
event< control, event_handlerxtd::forms::control::location_changed
 Occurs when the value of the location property changes. More...
 
event< control, event_handlerxtd::forms::control::lost_focus
 Occurs when the control loses focus. More...
 
event< control, mouse_event_handlerxtd::forms::control::mouse_click
 Occurs when the control is clicked by the mouse. More...
 
event< control, mouse_event_handlerxtd::forms::control::mouse_double_click
 Occurs when the control is double clicked by the mouse. More...
 
event< control, mouse_event_handlerxtd::forms::control::mouse_down
 Occurs when the mouse pointer is over the control and a mouse button is pressed. More...
 
event< control, event_handlerxtd::forms::control::mouse_enter
 Occurs when the mouse pointer enters the control. More...
 
event< control, mouse_event_handlerxtd::forms::control::mouse_horizontal_wheel
 Occurs when the mouse horizontal wheel moves while the control has focus. More...
 
event< control, event_handlerxtd::forms::control::mouse_leave
 Occurs when the mouse pointer leaves the control. More...
 
event< control, mouse_event_handlerxtd::forms::control::mouse_move
 Occurs when the mouse pointer is moved over the control. More...
 
event< control, mouse_event_handlerxtd::forms::control::mouse_up
 Occurs when the mouse pointer is over the control and a mouse button is released. More...
 
event< control, mouse_event_handlerxtd::forms::control::mouse_wheel
 Occurs when the mouse wheel moves while the control has focus. More...
 
event< text_box_base, event_handlerxtd::forms::text_box_base::multiline_changed
 Occurs when the value of the accepts_tab border_style has changed. More...
 
event< control, paint_event_handlerxtd::forms::control::paint
 Occurs when the control is redrawn. More...
 
event< control, event_handlerxtd::forms::control::parent_changed
 Occurs when the value of the parent property changes. More...
 
event< background_worker, progress_changed_event_handlerxtd::forms::background_worker::progress_changed
 Occurs when report_progress(int32_t) is called. More...
 
event< text_box_base, event_handlerxtd::forms::text_box_base::read_only_changed
 Occurs when the value of the read_only property has changed. More...
 
event< control, event_handlerxtd::forms::control::resize
 Occurs when the control is resized. More...
 
event< background_worker, run_worker_completed_event_handlerxtd::forms::background_worker::run_worker_completed
 Occurs when the background operation has completed, has been canceled, or has raised an exception. More...
 
event< scroll_bar, event_handlerxtd::forms::scroll_bar::scroll
 Occurs when the scroll box has been moved by either a mouse or keyboard action. More...
 
event< track_bar, event_handlerxtd::forms::track_bar::scroll
 Occurs when either a mouse or keyboard action moves the scroll box. More...
 
event< up_down_button, event_handlerxtd::forms::up_down_button::scroll
 Occurs when either a mouse or keyboard action moves the scroll box. More...
 
event< list_control, event_handlerxtd::forms::list_control::selected_index_changed
 Occurs when the selected_index property changes. More...
 
event< tab_control, event_handlerxtd::forms::tab_control::selected_index_changed
 Occurs when the selected_index property has changed. More...
 
event< domain_up_down, event_handlerxtd::forms::domain_up_down::selected_item_changed
 Occurs when the selected_item property has been changed. More...
 
event< list_control, event_handlerxtd::forms::list_control::selected_value_changed
 Occurs when the selected_value property changes. More...
 
event< control, event_handlerxtd::forms::control::size_changed
 Occurs when the value of the size property changes. More...
 
event< control, event_handlerxtd::forms::control::text_changed
 Occurs when the value of the text property changes. More...
 
static event< application, delegate< void(const event_args &)> > xtd::forms::application::thread_exit
 Occurs when a thread is about to shut down. When the main thread for an application is about to be shut down, this event is raised first, followed by an application_exit event. More...
 
event< application_context, event_handlerxtd::forms::application_context::thread_exit
 Occurs when the message loop of the thread should be terminated, by calling exit_thread(). More...
 
event< timer, event_handlerxtd::forms::timer::tick
 Occurs when the specified timer interval has elapsed and the timer is enabled. More...
 
xtd::event< animation, animation_updated_event_handlerxtd::forms::animation::updated
 Occurs when the specified interval specified by xtd::animation::frames_per_seconds has elapsed and the animation is started. More...
 
event< date_time_picker, event_handlerxtd::forms::date_time_picker::value_changed
 Occurs when the value of the value property changes. More...
 
event< domain_up_down, event_handlerxtd::forms::domain_up_down::value_changed
 Occurs when the value property has been changed. More...
 
event< numeric_up_down, event_handlerxtd::forms::numeric_up_down::value_changed
 Occurs when the value property has been changed in some way. More...
 
event< scroll_bar, event_handlerxtd::forms::scroll_bar::value_changed
 Occurs when the xtd::forms::scroll_bar::value property is changed, either by a xtd::forms::scroll_bar::scroll event or programmatically. More...
 
event< track_bar, event_handlerxtd::forms::track_bar::value_changed
 Occurs when the value property of a track bar changes, either by movement of the scroll box or by manipulation in code. More...
 
event< up_down_button, event_handlerxtd::forms::up_down_button::value_changed
 Occurs when the value of the value property changes. More...
 
event< control, event_handlerxtd::forms::control::visible_changed
 Occurs when the value of the visible property changes. More...
 

Typedef Documentation

◆ animation_updated_event_handler

#include <xtd.forms/include/xtd/forms/animation_update_event_handler.h>

Represents the method that will handle the update of xtd::forms::animation.

Parameters
senderThe source of the event.
eA xtd::forms::animation_updated_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms

◆ cancel_event_handler

using xtd::forms::cancel_event_handler = typedef delegate<void(object& sender, cancel_event_args& e)>

#include <xtd.forms/include/xtd/forms/cancel_event_handler.h>

Represents the method that handles a cancelable event.

Parameters
senderThe source of the event.
eA cancel_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms
Remarks
When you create a cancel_event_handler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event-handler method is called whenever the event occurs, unless you remove the delegate.

◆ console_cancel_event_handler

using xtd::console_cancel_event_handler = typedef xtd::delegate<void(console_cancel_event_args&)>

#include <xtd.core/include/xtd/console_cancel_event_handler.h>

Represents the method that will handle the cancel_key_press event of a xtd::console.

Parameters
senderThe source of the event.
eA xtd::console_cancel_event_args object that contains the event data.
Namespace
xtd
Library
xtd.core

◆ control_event_handler

using xtd::forms::control_event_handler = typedef delegate<void(object& sender, const control_event_args& e)>

#include <xtd.forms/include/xtd/forms/control_event_handler.h>

Represents the method that will handle the control_added and control_removed events of the control class.

Parameters
senderThe source of the event.
eA control_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms
Remarks
When you create a control_event_args delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate.

◆ data_received_event_handler

#include <xtd.core/include/xtd/diagnostics/data_received_event_handler.h>

Represents the method that will handle the xtd::diagnostics::process::output_data_received and xtd::diagnostics::process::error_data_received event of a Process.

Parameters
senderThe source of the event.
eA xtd::diagnostics::process::data_received_event_args that contains the event data.
Namespace
xtd::diagnostics
Library
xtd.core

◆ dialog_closed_event_handler

using xtd::forms::dialog_closed_event_handler = typedef delegate<void(object& sender, const dialog_closed_event_args& e)>

#include <xtd.forms/include/xtd/forms/dialog_closed_event_handler.h>

Provides handler for a dialog closed event.

Parameters
senderThe source of the event.
eAn dialog_closed_event_args that contains event data.
Namespace
xtd::forms
Library
xtd.forms

◆ do_work_event_handler

using xtd::forms::do_work_event_handler = typedef delegate<void(object& sender, do_work_event_args& e)>

#include <xtd.forms/include/xtd/forms/do_work_event_handler.h>

Represents the method that will handle the do_work event. This class cannot be inherited.

Parameters
senderThe source of the event.
eA do_work_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms
Remarks
When you create a do_work_event_handler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event-handler method is called whenever the event occurs, unless you remove the delegate

◆ event_handler

#include <xtd.core/include/xtd/event_handler.h>

Represents the method that will handle an event that has no event data.

Parameters
senderThe source of the event.
eAn object that contains no event data.
Namespace
xtd
Library
xtd.core
Examples
application_and_exception.cpp, choice.cpp, combo_box.cpp, form.cpp, and user_control.cpp.

◆ form_closed_event_handler

using xtd::forms::form_closed_event_handler = typedef delegate<void(object& sender, const form_closed_event_args& e)>

#include <xtd.forms/include/xtd/forms/form_closed_event_handler.h>

Represents the method that handles a form_closed event.

Parameters
senderThe source of the event.
eA form_closed_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms

◆ form_closing_event_handler

using xtd::forms::form_closing_event_handler = typedef delegate<void(object& sender, form_closing_event_args& e)>

#include <xtd.forms/include/xtd/forms/form_closing_event_handler.h>

Represents the method that handles a form_closing event.

Parameters
senderThe source of the event.
eA form_closing_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms

◆ generic_event_handler

template<typename event_args_t = const event_args&>
using xtd::generic_event_handler = typedef xtd::delegate<void(object& sender, event_args_t e)>

#include <xtd.core/include/xtd/event_handler.h>

Represents the method that will handle an event when the event provides data.

Template Parameters
event_args_tThe type of the event data generated by the event.
Parameters
senderThe source of the event.
eAn object that contains the event data.
Namespace
xtd
Library
xtd.core

◆ help_event_handler

using xtd::forms::help_event_handler = typedef delegate<void(object& sender, help_event_args& e)>

#include <xtd.forms/include/xtd/forms/help_event_handler.h>

Represents the method that will handle the help_requested event of a control.

Parameters
senderThe source of the event.
eA help_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms
Remarks
When you create a help_event_handler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate.

◆ item_check_event_handler

using xtd::forms::item_check_event_handler = typedef delegate<void(object& sender, item_check_event_args& e)>

#include <xtd.forms/include/xtd/forms/item_check_event_handler.h>

Represents the method that will handle the ItemCheck event of a CheckedListBox or ListView control.

Parameters
senderThe source of the event.
eAn ItemCheckEventArgs that contains the event data.
Namespace
xtd::forms
Library
xtd.forms
Remarks
When you create an item_check_event_handler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate.

◆ key_event_handler

using xtd::forms::key_event_handler = typedef delegate<void(object& sender, key_event_args& e)>

#include <xtd.forms/include/xtd/forms/key_event_handler.h>

Represents the method that will handle the key_up or key_down event of a control.

Parameters
senderThe source of the event.
eA key_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms

◆ key_press_event_handler

using xtd::forms::key_press_event_handler = typedef delegate<void(object& sender, key_press_event_args& e)>

#include <xtd.forms/include/xtd/forms/key_press_event_handler.h>

Represents the method that will handle the key_press event of a control.

Parameters
senderThe source of the event.
eA key_press_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms

◆ message_loop_callback

using xtd::forms::message_loop_callback = typedef delegate<bool()>

#include <xtd.forms/include/xtd/forms/message_loop_callback.h>

Represents a method that will check whether the hosting environment is still sending messages.

Namespace
xtd::forms
Library
xtd.forms
Returns
true if the hosting environment is still sending messages; otherwise, false.
Remarks
This delegate is used with the application::register_message_loop method.

◆ mouse_event_handler

using xtd::forms::mouse_event_handler = typedef delegate<void(object& sender, const mouse_event_args& e)>

#include <xtd.forms/include/xtd/forms/mouse_event_handler.h>

Represents the method that will handle the MouseDown, MouseUp, or MouseMove event of a form, control, or other component.

Parameters
senderThe source of the event.
eA xtd::forms::mouse_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms

◆ paint_event_handler

using xtd::forms::paint_event_handler = typedef delegate<void(object& sender, paint_event_args& e)>

#include <xtd.forms/include/xtd/forms/paint_event_handler.h>

Represents the method that will handle the paint event of a control.

Parameters
senderThe source of the event.
eA paint_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms

◆ progress_changed_event_handler

using xtd::forms::progress_changed_event_handler = typedef delegate<void(object& sender, const progress_changed_event_args& e)>

#include <xtd.forms/include/xtd/forms/progress_changed_event_handler.h>

Represents the method that will handle the do_work event. This class cannot be inherited.

Parameters
senderThe source of the event.
eA do_work_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms
Remarks
When you create a progress_changed_event_handler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event-handler method is called whenever the event occurs, unless you remove the delegate

◆ run_worker_completed_event_handler

#include <xtd.forms/include/xtd/forms/run_worker_completed_event_handler.h>

Represents the method that will handle the do_work event. This class cannot be inherited.

Parameters
senderThe source of the event.
eA do_work_event_args that contains the event data.
Namespace
xtd::forms
Library
xtd.forms
Remarks
When you create a run_worker_completed_event_handler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event-handler method is called whenever the event occurs, unless you remove the delegate

Function Documentation

◆ on_auto_size_changed()

virtual void xtd::forms::control::on_auto_size_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::auto_size_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_back_color_changed()

virtual void xtd::forms::control::on_back_color_changed ( const event_args e)
protectedvirtual

◆ on_background_image_changed()

virtual void xtd::forms::control::on_background_image_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::background_image_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_background_image_layout_changed()

virtual void xtd::forms::control::on_background_image_layout_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::background_image_layout_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_click()

virtual void xtd::forms::control::on_click ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::click event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::button.

◆ on_client_size_changed()

virtual void xtd::forms::control::on_client_size_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::client_size_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_control_added()

virtual void xtd::forms::control::on_control_added ( const control_event_args e)
protectedvirtual

◆ on_control_removed()

virtual void xtd::forms::control::on_control_removed ( const control_event_args e)
protectedvirtual

◆ on_create_control()

virtual void xtd::forms::control::on_create_control ( )
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::create_control event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_cursor_changed()

virtual void xtd::forms::control::on_cursor_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::cursor_changed event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::link_label.

◆ on_dock_changed()

virtual void xtd::forms::control::on_dock_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::dock_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_double_click()

virtual void xtd::forms::control::on_double_click ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the double_click event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_enabled_changed()

virtual void xtd::forms::control::on_enabled_changed ( const event_args e)
protectedvirtual

◆ on_font_changed()

virtual void xtd::forms::control::on_font_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::font_changed event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::label, xtd::forms::group_box, xtd::forms::button_base, and xtd::forms::font_picker.

◆ on_fore_color_changed()

virtual void xtd::forms::control::on_fore_color_changed ( const event_args e)
protectedvirtual

◆ on_got_focus()

virtual void xtd::forms::control::on_got_focus ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::got_focus event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::radio_button.

◆ on_handle_created()

virtual void xtd::forms::control::on_handle_created ( const event_args e)
protectedvirtual

◆ on_handle_destroyed()

virtual void xtd::forms::control::on_handle_destroyed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::handle_destroyed event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::form.

◆ on_key_down()

virtual void xtd::forms::control::on_key_down ( key_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::key_down event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_key_press()

virtual void xtd::forms::control::on_key_press ( key_press_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::key_press event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_key_up()

virtual void xtd::forms::control::on_key_up ( key_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::key_up event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_layout()

virtual void xtd::forms::control::on_layout ( const event_args e)
protectedvirtual

◆ on_location_changed()

virtual void xtd::forms::control::on_location_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::location_changed event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::form.

◆ on_lost_focus()

virtual void xtd::forms::control::on_lost_focus ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::lost_focus event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::radio_button.

◆ on_mouse_click()

virtual void xtd::forms::control::on_mouse_click ( const mouse_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::mouse_click event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::link_label.

◆ on_mouse_double_click()

virtual void xtd::forms::control::on_mouse_double_click ( const mouse_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::mouse_double_click event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_mouse_down()

virtual void xtd::forms::control::on_mouse_down ( const mouse_event_args e)
protectedvirtual

◆ on_mouse_enter()

virtual void xtd::forms::control::on_mouse_enter ( const event_args e)
protectedvirtual

◆ on_mouse_horizontal_wheel()

virtual void xtd::forms::control::on_mouse_horizontal_wheel ( const mouse_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::mouse_horizontal_wheel event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_mouse_leave()

virtual void xtd::forms::control::on_mouse_leave ( const event_args e)
protectedvirtual

◆ on_mouse_move()

virtual void xtd::forms::control::on_mouse_move ( const mouse_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::mouse_move event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::link_label, xtd::forms::splitter, and xtd::forms::radio_button.

◆ on_mouse_up()

virtual void xtd::forms::control::on_mouse_up ( const mouse_event_args e)
protectedvirtual

◆ on_mouse_wheel()

virtual void xtd::forms::control::on_mouse_wheel ( const mouse_event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::mouse_wheel event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_paint()

virtual void xtd::forms::control::on_paint ( paint_event_args e)
protectedvirtual

◆ on_parent_back_color_changed()

virtual void xtd::forms::control::on_parent_back_color_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::parent_back_color_changed event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::button_base.

◆ on_parent_changed()

virtual void xtd::forms::control::on_parent_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::parent_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_parent_cursor_changed()

virtual void xtd::forms::control::on_parent_cursor_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::parent_cursor_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_parent_enabled_changed()

virtual void xtd::forms::control::on_parent_enabled_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the xtd::control::enabled_changed event when the xtd::control::enabled property value of the control's container changes..

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::seven_segment_display.

◆ on_parent_font_changed()

virtual void xtd::forms::control::on_parent_font_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::parent_font_changed event.

Parameters
eAn xtd::event_args that contains the event data.

◆ on_parent_fore_color_changed()

virtual void xtd::forms::control::on_parent_fore_color_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::parent_fore_color_changed event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::button_base.

◆ on_resize()

virtual void xtd::forms::control::on_resize ( const event_args e)
protectedvirtual

◆ on_size_changed()

virtual void xtd::forms::control::on_size_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::size_changed event.

Parameters
eAn xtd::event_args that contains the event data.

Reimplemented in xtd::forms::lcd_label.

◆ on_text_changed()

virtual void xtd::forms::control::on_text_changed ( const event_args e)
protectedvirtual

◆ on_visible_changed()

virtual void xtd::forms::control::on_visible_changed ( const event_args e)
protectedvirtual

#include <xtd.forms/include/xtd/forms/control.h>

Raises the control::visible_changed event.

Parameters
eAn xtd::event_args that contains the event data.

Variable Documentation

◆ accepts_return_changed

event<text_box, event_handler> xtd::forms::text_box::accepts_return_changed

Occurs when the value of the accepts_return property has changed.

◆ accepts_tab_changed

event<text_box_base, event_handler> xtd::forms::text_box_base::accepts_tab_changed

Occurs when the value of the accepts_tab property has changed.

◆ activated

event<form, event_handler> xtd::forms::form::activated

Occurs when the form is activated in code or by the user.

◆ appearance_changed [1/2]

event<check_box, event_handler> xtd::forms::check_box::appearance_changed

Occurs when the value of the appearance property changes.

◆ appearance_changed [2/2]

event<radio_button, event_handler> xtd::forms::radio_button::appearance_changed

Occurs when the appearance property value changes.

◆ application_exit

event<application, delegate<void(const event_args&)> > xtd::forms::application::application_exit
static

Occurs when the application is about to shut down.

Remarks
You must attach the event handlers to the application_exit event to perform unhandled, required tasks before the application stops running. You can close files opened by this application, or dispose of objects that garbage collection did not reclaim.

◆ apply

event<font_dialog, event_handler> xtd::forms::font_dialog::apply

Occurs when the user clicks the Apply button in the font dialog box.

Remarks
Every time the Apply button is clicked, another apply event is raised.

◆ auto_size_changed

event<control, event_handler> xtd::forms::control::auto_size_changed

Occurs when the value of the auto_size property changes.

Remarks
This event is raised if the auto_size property is changed by either a programmatic modification or user interaction.

◆ back_color_changed

event<control, event_handler> xtd::forms::control::back_color_changed

Occurs when the value of the back_color property changes.

Remarks
This event is raised if the back_color property is changed by either a programmatic modification or user interaction.

◆ background_image_changed

event<control, event_handler> xtd::forms::control::background_image_changed

Occurs when the value of the background_image property changes.

Remarks
This event is raised if the background_image property is changed by either a programmatic modification or user interaction

◆ background_image_layout_changed

event<control, event_handler> xtd::forms::control::background_image_layout_changed

Occurs when the value of the background_image_layout property changes.

Remarks
This event is raised if the background_image_layout property is changed by either a programmatic modification or user interaction

◆ border_style_changed

event<text_box_base, event_handler> xtd::forms::text_box_base::border_style_changed

Occurs when the value of the accepts_tab border_style has changed.

◆ check_state_changed [1/2]

event<check_box, event_handler> xtd::forms::check_box::check_state_changed

Occurs when the value of the check_state property changes.

◆ check_state_changed [2/2]

event<toggle_button, event_handler> xtd::forms::toggle_button::check_state_changed

Occurs when the value of the check_state property changes.

◆ checked_changed [1/4]

event<check_box, event_handler> xtd::forms::check_box::checked_changed

Occurs when the value of the checked property changes.

◆ checked_changed [2/4]

event<radio_button, event_handler> xtd::forms::radio_button::checked_changed

Occurs when the value of the checked property changes.

◆ checked_changed [3/4]

event<switch_button, event_handler> xtd::forms::switch_button::checked_changed

Occurs when the value of the checked property changes.

◆ checked_changed [4/4]

event<toggle_button, event_handler> xtd::forms::toggle_button::checked_changed

Occurs when the value of the checked property changes.

◆ click

event<control, event_handler> xtd::forms::control::click

Occurs when the control is clicked.

Remarks
The click event passes an xtd::event_args to its event handler, so it only indicates that a click has occurred. If you need more specific mouse information (button, number of clicks, wheel rotation, or location), use the mouse_click event. However, the mouse_click event will not be raised if the click is caused by action other than that of the mouse, such as pressing the ENTER key.
A double-click is determined by the mouse settings of the user's operating system. The user can set the time between clicks of a mouse button that should be considered a double-click rather than two clicks. The click event is raised every time a control is double-clicked. For example, if you have event handlers for the click and double_click events of a xtd::forms::form, the click and double_click events are raised when the form is double-clicked and both methods are called. If a control is double-clicked and that control does not support the double_click event, the click event might be raised twice.
You must set the standard_click value of xtd::forms::control_styles to true for this event to be raised.
Note
The following events are not raised for the xtd::forms::tab_control class unless there is at least one xtd::forms::tab_page in the xtd::forms::tab_control. xtd::forms::tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one xtd::forms::tab_page in the collection, and the user interacts with the tab control's header (where the xtd::forms::tab_page names appear), the xtd::forms::tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the xtd::forms::tab_page raises the appropriate event.
Notes to Inheritors
Inheriting from a standard Windows Forms control and changing the standard_click or standard_double_click values of xtd::forms::control_styles to true can cause unexpected behavior or have no effect at all if the control does not support the click or double_click events.
Remarks
The following table lists Windows Forms controls and which event (click or double_click) is raised in response to the mouse action specified.
Control Left Mouse Click Left Mouse Double Click Right Mouse Click Right Mouse Click Middle Mouse Click Middle Mouse Double Click XButton1 Mouse Click XButton1 Mouse Double-Click XButton2 Mouse Click XButton2 Mouse Double-Click
xtd::forms::month_calendar, xtd::forms::date_time_picker, xtd::forms::h_scroll_bar, xtd::forms::v_scroll_bar none none none none none none none none none none
xtd::forms::button, xtd::forms::check_box, xtd::forms::color_picker, xtd::forms::command_link_button, xtd::forms::font_picker, xtd::forms::rich_text_box, xtd::forms::radio_button, xtd::forms::switch_button, xtd::forms::toggle_button click click, click none none none none none none none none
xtd::forms::list_box, xtd::forms::checked_list_box, xtd::forms::choice, xtd::forms::combo_box click click, double_click none none none none none none none none
xtd::forms::text_box, xtd::forms::domain_up_down, xtd::forms::numeric_up_down click click, double_click none none none none none none none none
* xtd::forms::tree_view, * xtd::forms::list_view click click, double_click click click, double_click none none none none none none
xtd::forms::progress_bar, xtd::forms::track_bar click click, click click click, click click click, click click click, click click click, click
xtd::forms::form, xtd::forms::collapsible_panel, xtd::forms::data_grid, xtd::forms::dot_matrix_display, xtd::forms::label, xtd::forms::lcd_label, xtd::forms::link_label, xtd::forms::nine_segment_display, xtd::forms::seven_segment_display, xtd::forms::sixteen_segment_display, xtd::forms::panel, xtd::forms::group_box, xtd::forms::picture_box, xtd::forms::splitter, xtd::forms::status_bar, xtd::forms::tool_bar, xtd::forms::tab_page, ** xtd::forms::tab_control click click, double_click click click, double_click click click, double_click click click, double_click click click, double_click

* The mouse pointer must be over a child object (xtd::forms::tree_node or xtd::forms::list_view_item).
** The xtd::forms::tab_control must have at least one xtd::forms::tab_page in its xtd::forms::tab_pages collection.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition: trace.h:323
static void run()
Begins running a standard application message loop on the current thread, without a form.
virtual const xtd::ustring & text() const
Gets the text associated with this control.
Definition: control.h:650
static forms::keys modifier_keys()
Gets a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.
Definition: control.h:565
event< control, event_handler > double_click
Occurs when the control is double-clicked.
Definition: control.h:1112
event< control, event_handler > click
Occurs when the control is clicked.
Definition: control.h:1065
event< control, mouse_event_handler > mouse_down
Occurs when the mouse pointer is over the control and a mouse button is pressed.
Definition: control.h:1278
event< control, event_handler > mouse_enter
Occurs when the mouse pointer enters the control.
Definition: control.h:1292
event< control, mouse_event_handler > mouse_double_click
Occurs when the control is double clicked by the mouse.
Definition: control.h:1264
event< control, event_handler > mouse_leave
Occurs when the mouse pointer leaves the control.
Definition: control.h:1321
event< control, mouse_event_handler > mouse_move
Occurs when the mouse pointer is moved over the control.
Definition: control.h:1335
event< control, mouse_event_handler > mouse_up
Occurs when the mouse pointer is over the control and a mouse button is released.
Definition: control.h:1349
event< control, mouse_event_handler > mouse_horizontal_wheel
Occurs when the mouse horizontal wheel moves while the control has focus.
Definition: control.h:1307
event< control, mouse_event_handler > mouse_wheel
Occurs when the mouse wheel moves while the control has focus.
Definition: control.h:1364
event< control, mouse_event_handler > mouse_click
Occurs when the control is clicked by the mouse.
Definition: control.h:1244
@ e
The E key.
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

◆ client_size_changed

event<control, event_handler> xtd::forms::control::client_size_changed

Occurs when the value of the client_size property changes.

Remarks
This event is raised if the client_size property is changed by either a programmatic modification or user interaction.

◆ color_changed

event<color_picker, event_handler> xtd::forms::color_picker::color_changed

Occurs when the value of the color property changes.

◆ control_added

event<control, control_event_handler> xtd::forms::control::control_added

Occurs when a new control is added to the control::control_collection.

◆ control_removed

event<control, control_event_handler> xtd::forms::control::control_removed

Occurs when a new control is removed to the control::control_collection.

◆ cursor_changed

event<control, event_handler> xtd::forms::control::cursor_changed

Occurs when the value of the cursor property changes.

Remarks
This event is raised if the cursor property is changed by either a programmatic modification or user interaction.

◆ deactivate

event<form, event_handler> xtd::forms::form::deactivate

Occurs when the form loses focus and is no longer the active form.

◆ dialog_closed [1/3]

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

Occurs when the user close a common dialog box with dialog close button or other dialog buttons.

◆ dialog_closed [2/3]

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.

◆ dialog_closed [3/3]

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

Occurs when the user close a message dialog box with dialog close button or other dialog buttons.

◆ do_work

event<background_worker, do_work_event_handler> xtd::forms::background_worker::do_work

Occurs when run_worker_async() is called.

◆ dock_changed

event<control, event_handler> xtd::forms::control::dock_changed

Occurs when the value of the dock property changes.

Remarks
This event is raised if the dock property is changed by either a programmatic modification or user interaction.

◆ double_click

event<control, event_handler> xtd::forms::control::double_click

Occurs when the control is double-clicked.

Remarks
A double-click is determined by the mouse settings of the user's operating system. The user can set the time between clicks of a mouse button that should be considered a double-click rather than two clicks. The click event is raised every time a control is double-clicked. For example, if you have event handlers for the click and double_click events of a xtd::forms::form, the click and double_click events are raised when the form is double-clicked and both methods are called. If a control is double-clicked and that control does not support the double_click event, the click event might be raised twice.
You must set the standard_double_click and standard_click value of xtd::forms::control_styles to true for this event to be raised.
Note
The following events are not raised for the xtd::forms::tab_control class unless there is at least one xtd::forms::tab_page in the xtd::forms::tab_control. xtd::forms::tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one xtd::forms::tab_page in the collection, and the user interacts with the tab control's header (where the xtd::forms::tab_page names appear), the xtd::forms::tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the xtd::forms::tab_page raises the appropriate event.
Notes to Inheritors
Inheriting from a standard Windows Forms control and changing the standard_click or standard_double_click values of xtd::forms::control_styles to true can cause unexpected behavior or have no effect at all if the control does not support the click or double_click events.
Remarks
The following table lists Windows Forms controls and which event (click or double_click) is raised in response to the mouse action specified.
Control Left Mouse Click Left Mouse Double Click Right Mouse Click Right Mouse Click Middle Mouse Click Middle Mouse Double Click XButton1 Mouse Click XButton1 Mouse Double-Click XButton2 Mouse Click XButton2 Mouse Double-Click
xtd::forms::month_calendar, xtd::forms::date_time_picker, xtd::forms::h_scroll_bar, xtd::forms::v_scroll_bar none none none none none none none none none none
xtd::forms::button, xtd::forms::check_box, xtd::forms::color_picker, xtd::forms::command_link_button, xtd::forms::font_picker, xtd::forms::rich_text_box, xtd::forms::radio_button, xtd::forms::switch_button, xtd::forms::toggle_button click click, click none none none none none none none none
xtd::forms::list_box, xtd::forms::checked_list_box, xtd::forms::choice, xtd::forms::combo_box click click, double_click none none none none none none none none
xtd::forms::text_box, xtd::forms::domain_up_down, xtd::forms::numeric_up_down click click, double_click none none none none none none none none
* xtd::forms::tree_view, * xtd::forms::list_view click click, double_click click click, double_click none none none none none none
xtd::forms::progress_bar, xtd::forms::track_bar click click, click click click, click click click, click click click, click click click, click
xtd::forms::form, xtd::forms::collapsible_panel, xtd::forms::data_grid, xtd::forms::dot_matrix_display, xtd::forms::label, xtd::forms::lcd_label, xtd::forms::link_label, xtd::forms::nine_segment_display, xtd::forms::seven_segment_display, xtd::forms::sixteen_segment_display, xtd::forms::panel, xtd::forms::group_box, xtd::forms::picture_box, xtd::forms::splitter, xtd::forms::status_bar, xtd::forms::tool_bar, xtd::forms::tab_page, ** xtd::forms::tab_control click click, double_click click click, double_click click click, double_click click click, double_click click click, double_click

* The mouse pointer must be over a child object (xtd::forms::tree_node or xtd::forms::list_view_item).
** The xtd::forms::tab_control must have at least one xtd::forms::tab_page in its xtd::forms::tab_pages collection.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ drop_down_style_changed

event<combo_box, event_handler> xtd::forms::combo_box::drop_down_style_changed

Occurs when the drop_down_style property has changed.

◆ enabled_changed

event<control, event_handler> xtd::forms::control::enabled_changed

Occurs when the value of the enabled property changes.

Remarks
This event is raised if the enabled property is changed by either a programmatic modification or user interaction.

◆ enter_thread_modal

event<application, delegate<void(const event_args&)> > xtd::forms::application::enter_thread_modal
static

Occurs when the application is about to enter a modal state.

◆ expanded_changed

xtd::event<collapsible_panel, xtd::event_handler> xtd::forms::collapsible_panel::expanded_changed

Occurs when the expanded property changes.

◆ font_changed [1/2]

event<control, event_handler> xtd::forms::control::font_changed

Occurs when the value of the font property changes.

Remarks
This event is raised if the font property is changed by either a programmatic modification or user interaction.

◆ font_changed [2/2]

event<font_picker, event_handler> xtd::forms::font_picker::font_changed

Occurs when the value of the font property changes.

◆ fore_color_changed

event<control, event_handler> xtd::forms::control::fore_color_changed

Occurs when the value of the fore_color property changes.

Remarks
This event is raised if the fore_color property is changed by either a programmatic modification or user interaction.

◆ form_closed

event<form, form_closed_event_handler> xtd::forms::form::form_closed

Occurs after the form is closed.

◆ form_closing

event<form, form_closing_event_handler> xtd::forms::form::form_closing

Occurs before the form is closed.

◆ got_focus

event<control, event_handler> xtd::forms::control::got_focus

Occurs when the control receives focus.

Remarks
When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), by calling the select or select_next_control methods, or by setting the container_control::active_control property to the current form, focus events occur in the following order:
  1. xtd::forms::control::enter event
  2. xtd::forms::control::got_focus event
  3. xtd::forms::control::leave event
  4. xtd::forms::control::validating event
  5. xtd::forms::control::validated event
  6. xtd::forms::control::lost_focus event
When you change the focus by using the mouse or by calling the focus method, focus events occur in the following order:
  1. xtd::forms::control::enter event
  2. xtd::forms::control::got_focus event
  3. xtd::forms::control::lost_focus event
  4. xtd::forms::control::leave event
  5. xtd::forms::control::validating event
  6. xtd::forms::control::validated event
If the causes_validation property is set to false, the xtd::forms::control::validating and xtd::forms::control::validated events are suppressed.
Note The got_focus and lost_focus events are low-level focus events that are tied to the WM_KILLFOCUS and WM_SETFOCUS Windows messages. Typically, the got_focus and lost_focus events are only used when updating when writing custom controls. Instead the enter and leave events should be used for all controls except the xtd::forms::form class, which uses the activated and deactivate events.
Warning
Do not attempt to set focus from within the enter, got_focus, leave, lost_focus, validating, or validated event handlers. Doing so can cause your application or the operating system to stop responding.

◆ handle_created

event<control, event_handler> xtd::forms::control::handle_created

Occurs when a handle is created for the control.

Remarks
A handle is created when the xtd::forms::control is displayed for the first time. For example, if a xtd::forms::control is created that has visible set to false, the handle_created event will not be raised until visible is set to true.

◆ handle_destroyed

event<control, event_handler> xtd::forms::control::handle_destroyed

Occurs when the control's handle is in the process of being destroyed.

Remarks
During the handle_destroyed event, the control is still a valid Windows control and the handle can be recreated by calling the recreate_handle method.

◆ help_request [1/2]

event<common_dialog, help_event_handler> xtd::forms::common_dialog::help_request

Occurs when the user clicks the Help button on a common dialog box.

◆ help_request [2/2]

event<message_dialog, help_event_handler> xtd::forms::message_dialog::help_request

Occurs when the user clicks the Help button on a common dialog box.

◆ idle

event<application, delegate<void(const event_args&)> > xtd::forms::application::idle
static

Occurs when the application finishes processing and is about to enter the idle state.

Remarks
If you have tasks that you must perform before the thread becomes idle, attach them to this event.
Examples
The following code example demonstrate the use of application idle event.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
application::idle += {*this, &form1::on_application_idle};
}
private:
void on_application_idle(const event_args& e) {
text(ustring::format("{}", ++counter));
}
int counter = 0;
};
}
int main() {
application::run(examples::form1());
}
static event< application, delegate< void(const event_args &)> > idle
Occurs when the application finishes processing and is about to enter the idle state.
Definition: application.h:297
static ustring format(const ustring &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition: ustring.h:689

◆ image_changed

event<button_base, event_handler> xtd::forms::button_base::image_changed

Occurs when the value of the image property changes.

Remarks
This event is raised if the image property is changed by either a programmatic modification or user interaction.

◆ key_down

event<control, key_event_handler> xtd::forms::control::key_down

Occurs when a key is pressed while the control has focus.

Remarks
Key events occur in the following order:
  1. xtd::forms::control::key_down event
  1. xtd::forms::control::key_press event
  1. xtd::forms::control::key_up event
To handle keyboard events only at the form level and not enable other controls to receive keyboard events, set the key_press_event_args::handled property in your form's key_press event-handling method to true. Certain keys, such as the TAB, RETURN, ESC, and arrow keys are handled by controls automatically. To have these keys raise the key_down event, you must override the is_input_key method in each control on your form. The code for the override of the is_input_key would need to determine if one of the special keys is pressed and return a value of true. Instead of overriding the is_input_key method, you can handle the preview_key_down event and set the is_input_key property to true.
Examples
The following code example demonstrate the use of control keyboard events.
#define TRACE
#include <xtd/xtd>
using namespace std;
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Key events example");
key_down += [&](object& sender, key_event_args& e) {
ctrace << ustring::format("key_down={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << endl;
};
key_press += [&](object& sender, key_press_event_args& e) {
ctrace << ustring::format("key_press={{key_char={}}}", e.key_char() == 0 ? "[none]" : ustring::format("'{}'", e.key_char())) << endl;
};
key_up += [&](object& sender, key_event_args& e) {
ctrace << ustring::format("key_up={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << endl;
if (e.modifiers() == keys::none) ctrace << endl;
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}
event< control, key_event_handler > key_up
Occurs when a key is released while the control has focus.
Definition: control.h:1196
event< control, key_press_event_handler > key_press
Occurs when a character. space or backspace key is pressed while the control has focus.
Definition: control.h:1184
event< control, key_event_handler > key_down
Occurs when a key is pressed while the control has focus.
Definition: control.h:1170
std::ostream ctrace(nullptr)
Provides an std::ostream for xtd::diagnostics::trace.
@ none
No key pressed.

◆ key_press

event<control, key_press_event_handler> xtd::forms::control::key_press

Occurs when a character. space or backspace key is pressed while the control has focus.

Remarks
Key events occur in the following order:
  1. xtd::forms::control::key_down event
  1. xtd::forms::control::key_press event
  1. xtd::forms::control::key_up event
The key_press event is not raised by non-character keys other than space and backspace; however, the non-character keys do raise the key_down and key_up events.
Use the xtd::forms::key_press_event_args::key_char property to sample keystrokes at run time and to consume or modify a subset of common keystrokes.
To handle keyboard events only at the form level and not enable other controls to receive keyboard events, set the key_press_event_args::handled property in your form's key_press event-handling method to true.
Examples
The following code example demonstrate the use of control keyboard events.
#define TRACE
#include <xtd/xtd>
using namespace std;
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Key events example");
key_down += [&](object& sender, key_event_args& e) {
ctrace << ustring::format("key_down={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << endl;
};
key_press += [&](object& sender, key_press_event_args& e) {
ctrace << ustring::format("key_press={{key_char={}}}", e.key_char() == 0 ? "[none]" : ustring::format("'{}'", e.key_char())) << endl;
};
key_up += [&](object& sender, key_event_args& e) {
ctrace << ustring::format("key_up={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << endl;
if (e.modifiers() == keys::none) ctrace << endl;
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ key_up

event<control, key_event_handler> xtd::forms::control::key_up

Occurs when a key is released while the control has focus.

Remarks
Key events occur in the following order:
  1. xtd::forms::control::key_down event
  1. xtd::forms::control::key_press event
  1. xtd::forms::control::key_up event
To handle keyboard events only at the form level and not enable other controls to receive keyboard events, set the key_press_event_args::handled property in your form's key_press event-handling method to true. Certain keys, such as the TAB, RETURN, ESC, and arrow keys are handled by controls automatically. To have these keys raise the key_down event, you must override the is_input_key method in each control on your form. The code for the override of the is_input_key would need to determine if one of the special keys is pressed and return a value of true. Instead of overriding the is_input_key method, you can handle the preview_key_down event and set the is_input_key property to true.
Examples
The following code example demonstrate the use of control keyboard events.
#define TRACE
#include <xtd/xtd>
using namespace std;
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Key events example");
key_down += [&](object& sender, key_event_args& e) {
ctrace << ustring::format("key_down={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << endl;
};
key_press += [&](object& sender, key_press_event_args& e) {
ctrace << ustring::format("key_press={{key_char={}}}", e.key_char() == 0 ? "[none]" : ustring::format("'{}'", e.key_char())) << endl;
};
key_up += [&](object& sender, key_event_args& e) {
ctrace << ustring::format("key_up={{key_code={}, key_data=[{}], value=0x{:X4}, modifiers=[{}]}}", e.key_code(), e.key_data(), e.key_value(), e.modifiers()) << endl;
if (e.modifiers() == keys::none) ctrace << endl;
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ layout

event<control, event_handler> xtd::forms::control::layout

Occurs when a control should reposition its child controls.

Remarks
The layout event occurs when child controls are added or removed, when the bounds of the control changes, and when other changes occur that can affect the layout of the control. The layout event can be suppressed using the suspend_layout and resume_layout methods. Suspending layout enables you to perform multiple actions on a control without having to perform a layout for each change. For example, if you resize and move a control, each operation would raise a layout event.

◆ leave_thread_modal

event<application, delegate<void(const event_args&)> > xtd::forms::application::leave_thread_modal
static

Occurs when the application is about to leave a modal state.

◆ location_changed

event<control, event_handler> xtd::forms::control::location_changed

Occurs when the value of the location property changes.

Remarks
This event is raised if the location property is changed by either a programmatic modification or user interaction.

◆ lost_focus

event<control, event_handler> xtd::forms::control::lost_focus

Occurs when the control loses focus.

Remarks
When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), by calling the select or select_next_control methods, or by setting the container_control::active_control property to the current form, focus events occur in the following order:
  1. xtd::forms::control::enter event
  2. xtd::forms::control::got_focus event
  3. xtd::forms::control::leave event
  4. xtd::forms::control::validating event
  5. xtd::forms::control::validated event
  6. xtd::forms::control::lost_focus event
When you change the focus by using the mouse or by calling the focus method, focus events occur in the following order:
  1. xtd::forms::control::enter event
  2. xtd::forms::control::got_focus event
  3. xtd::forms::control::lost_focus event
  4. xtd::forms::control::leave event
  5. xtd::forms::control::validating event
  6. xtd::forms::control::validated event
If the causes_validation property is set to false, the xtd::forms::control::validating and xtd::forms::control::validated events are suppressed.
If the cancel property of the xtd::forms::cancel_event_args is set to true in the validating event delegate, all events that would usually occur after the validating event are suppressed.
Note The got_focus and lost_focus events are low-level focus events that are tied to the WM_KILLFOCUS and WM_SETFOCUS Windows messages. Typically, the got_focus and lost_focus events are only used when updating when writing custom controls. Instead the enter and leave events should be used for all controls except the xtd::forms::form class, which uses the activated and deactivate events.
Warning
Do not attempt to set focus from within the enter, got_focus, leave, lost_focus, validating, or validated event handlers. Doing so can cause your application or the operating system to stop responding.

◆ mouse_click

event<control, mouse_event_handler> xtd::forms::control::mouse_click

Occurs when the control is clicked by the mouse.

Remarks
Depressing a mouse button when the cursor is over a control typically raises the following series of events from the control:
  1. xtd::forms::control::mouse_down event
  2. xtd::forms::control::click event
  3. xtd::forms::control::mouse_click event
  4. xtd::forms::control::mouse_up event
For this to occur, the various events cannot be disabled in the control's class.
Two single clicks that occur close enough in time, as determined by the mouse settings of the user's operating system, will generate a mouse_double_click event instead of the second mouse_click event.
important
click events are logically higher-level events of a control. They are often raised by other actions, such as pressing the ENTER key when the control has focus.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_double_click

event<control, mouse_event_handler> xtd::forms::control::mouse_double_click

Occurs when the control is double clicked by the mouse.

Remarks
The mouse_double_click event occurs when the user depresses a mouse button twice in quick succession when the cursor is over the control. The time interval that separates two single clicks from a double-click is determined by the mouse settings of the user's operating system.
The following series of events is raised by the control when such a user action takes place:
  1. xtd::forms::control::mouse_down event
  2. xtd::forms::control::click event
  3. xtd::forms::control::mouse_click event
  4. xtd::forms::control::mouse_up event
  5. xtd::forms::control::mouse_down event
  6. xtd::forms::control::double_click event
  7. xtd::forms::control::mouse_click event
  8. xtd::forms::control::mouse_up event
For this to occur, the various events cannot be disabled in the control's class.
important
double_click events are logically higher-level events of a control. They may be raised by other user actions, such as shortcut key combinations.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_down

event<control, mouse_event_handler> xtd::forms::control::mouse_down

Occurs when the mouse pointer is over the control and a mouse button is pressed.

Remarks
Mouse events occur in the following order:
  1. xtd::forms::control::mouse_enter
  2. xtd::forms::control::mouse_move
  3. xtd::forms::control::mouse_hover / xtd::forms::control::mouse_down / xtd::forms::control::mouse_wheel / xtd::forms::control::mouse_horizontal_wheel
  4. xtd::forms::control::mouse_up
  5. xtd::forms::control::mouse_leave
Note
The following events are not raised for the tab_control class unless there is at least one tab_page in the tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one tab_page in the collection, and the user interacts with the tab control's header (where the tab_page names appear), the tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the tab_page raises the appropriate event.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_enter

event<control, event_handler> xtd::forms::control::mouse_enter

Occurs when the mouse pointer enters the control.

Remarks
Mouse events occur in the following order:
  1. xtd::forms::control::mouse_enter
  2. xtd::forms::control::mouse_move
  3. xtd::forms::control::mouse_hover / xtd::forms::control::mouse_down / xtd::forms::control::mouse_wheel / xtd::forms::control::mouse_horizontal_wheel
  4. xtd::forms::control::mouse_up
  5. xtd::forms::control::mouse_leave
Note
The following events are not raised for the tab_control class unless there is at least one tab_page in the tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one tab_page in the collection, and the user interacts with the tab control's header (where the tab_page names appear), the tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the tab_page raises the appropriate event.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_horizontal_wheel

event<control, mouse_event_handler> xtd::forms::control::mouse_horizontal_wheel

Occurs when the mouse horizontal wheel moves while the control has focus.

Remarks
When handling the mouse_horizontal_wheel event it is important to follow the user interface (UI) standards associated with the mouse wheel. The mouse_event_args::delta property value indicates the amount the mouse wheel has been moved.
Mouse events occur in the following order:
  1. xtd::forms::control::mouse_enter
  2. xtd::forms::control::mouse_move
  3. xtd::forms::control::mouse_hover / xtd::forms::control::mouse_down / xtd::forms::control::mouse_wheel / xtd::forms::control::mouse_horizontal_wheel
  4. xtd::forms::control::mouse_up
  5. xtd::forms::control::mouse_leave
Note
The following events are not raised for the tab_control class unless there is at least one tab_page in the tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one tab_page in the collection, and the user interacts with the tab control's header (where the tab_page names appear), the tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the tab_page raises the appropriate event.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_leave

event<control, event_handler> xtd::forms::control::mouse_leave

Occurs when the mouse pointer leaves the control.

Remarks
Mouse events occur in the following order:
  1. xtd::forms::control::mouse_enter
  2. xtd::forms::control::mouse_move
  3. xtd::forms::control::mouse_hover / xtd::forms::control::mouse_down / xtd::forms::control::mouse_wheel / xtd::forms::control::mouse_horizontal_wheel
  4. xtd::forms::control::mouse_up
  5. xtd::forms::control::mouse_leave
Note
The following events are not raised for the tab_control class unless there is at least one tab_page in the tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one tab_page in the collection, and the user interacts with the tab control's header (where the tab_page names appear), the tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the tab_page raises the appropriate event.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_move

event<control, mouse_event_handler> xtd::forms::control::mouse_move

Occurs when the mouse pointer is moved over the control.

Remarks
Mouse events occur in the following order:
  1. xtd::forms::control::mouse_enter
  2. xtd::forms::control::mouse_move
  3. xtd::forms::control::mouse_hover / xtd::forms::control::mouse_down / xtd::forms::control::mouse_wheel / xtd::forms::control::mouse_horizontal_wheel
  4. xtd::forms::control::mouse_up
  5. xtd::forms::control::mouse_leave
Note
The following events are not raised for the tab_control class unless there is at least one tab_page in the tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one tab_page in the collection, and the user interacts with the tab control's header (where the tab_page names appear), the tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the tab_page raises the appropriate event.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_up

event<control, mouse_event_handler> xtd::forms::control::mouse_up

Occurs when the mouse pointer is over the control and a mouse button is released.

Remarks
Mouse events occur in the following order:
  1. xtd::forms::control::mouse_enter
  2. xtd::forms::control::mouse_move
  3. xtd::forms::control::mouse_hover / xtd::forms::control::mouse_down / xtd::forms::control::mouse_wheel / xtd::forms::control::mouse_horizontal_wheel
  4. xtd::forms::control::mouse_up
  5. xtd::forms::control::mouse_leave
Note
The following events are not raised for the tab_control class unless there is at least one tab_page in the tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one tab_page in the collection, and the user interacts with the tab control's header (where the tab_page names appear), the tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the tab_page raises the appropriate event.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ mouse_wheel

event<control, mouse_event_handler> xtd::forms::control::mouse_wheel

Occurs when the mouse wheel moves while the control has focus.

Remarks
When handling the mouse_wheel event it is important to follow the user interface (UI) standards associated with the mouse wheel. The mouse_event_args::delta property value indicates the amount the mouse wheel has been moved. The UI should scroll when the accumulated delta is plus or minus 120. The UI should scroll the number of logical lines returned by the system_information::mouse_wheel_scroll_lines property for every delta value reached. You can also scroll more smoothly in smaller that 120 unit increments, however the ratio should remain constant, that is system_information::mouse_wheel_scroll_lines lines scrolled per 120 delta units of wheel movement.
Mouse events occur in the following order:
  1. xtd::forms::control::mouse_enter
  2. xtd::forms::control::mouse_move
  3. xtd::forms::control::mouse_hover / xtd::forms::control::mouse_down / xtd::forms::control::mouse_wheel / xtd::forms::control::mouse_horizontal_wheel
  4. xtd::forms::control::mouse_up
  5. xtd::forms::control::mouse_leave
Note
The following events are not raised for the tab_control class unless there is at least one tab_page in the tab_control::tab_pages collection: click, double_click, mouse_down, mouse_up, mouse_hover, mouse_enter, mouse_leave and mouse_move. If there is at least one tab_page in the collection, and the user interacts with the tab control's header (where the tab_page names appear), the tab_control raises the appropriate event. However, if the user interaction is within the client area of the tab page, the tab_page raises the appropriate event.
Examples
The following code example demonstrate the use of control mouse events.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Mouse events example");
click += [&] {
};
double_click += [&] {
};
mouse_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_double_click += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_double_click={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_down += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_down={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_enter += [&] {
};
mouse_horizontal_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_horizontal_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_leave += [&] {
};
mouse_move += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_move={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_up += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_up={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
mouse_wheel += [&](object& sender, const mouse_event_args& e) {
xtd::diagnostics::trace::write_line("mouse_wheel={{button={}, clicks={}, delta={}, location=[{}], modifier_keys=[{}]}}", e.button(), e.clicks(), e.delta(), e.location(), modifier_keys());
};
}
};
int main() {
trace_form trace_form;
application::run(form1());
}

◆ multiline_changed

event<text_box_base, event_handler> xtd::forms::text_box_base::multiline_changed

Occurs when the value of the accepts_tab border_style has changed.

◆ paint

event<control, paint_event_handler> xtd::forms::control::paint

Occurs when the control is redrawn.

Remarks
The paint event is raised when the control is redrawn. It passes an instance of paint_event_args to the method(s) that handles the paint event. The paint event is raised when the control is redrawn. It passes an instance of paint_event_args to the method(s) that handles the paint event.
When creating a new custom control or an inherited control with a different visual appearance, you must provide code to render the control by overriding the on_paint method.
Examples
The following code example demonstrate the use of control paint events.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
text("Paint example");
location({100, 100});
client_size({640, 480});
paint += [](object& sender, paint_event_args& e) {
e.graphics().fill_rectangle(brushes::blue(), 0, 0, 640, 480);
e.graphics().clear(color::light_yellow);
e.graphics().draw_rectangle(pen(color::light_pink, 10), e.clip_rectangle());
e.graphics().draw_line(pen(color::light_steel_blue, 5), 20, 60, 260, 60);
e.graphics().fill_rectangle(brushes::light_blue(), 50, 300, 400, 50);
e.graphics().draw_line(pens::red(), 0, 0, 1, 1);
e.graphics().draw_string("Draw string", drawing::font("Arial", 34, font_style::regular), brushes::light_green(), 20.0f, 0.0f);
e.graphics().fill_rectangle(brushes::light_sea_green(), 400, 70, 100, 200);
e.graphics().draw_arc(pen(color::black, 10), 400, 70, 100, 200, 45, 270);
e.graphics().draw_ellipse(pen(color::red, 10), 100, 80, 200, 200);
e.graphics().fill_pie(brushes::green(), 120, 100, 160, 160, 45, 270);
e.graphics().fill_pie(brushes::light_green(), 120, 100, 160, 160, 270, 180);
e.graphics().draw_bezier(pens::black(), 100, 100, 150, 150, 200, 100, 250, 50);
};
}
};
}
int main() {
application::run(examples::form1());
}
virtual const drawing::size & client_size() const
Gets the height and width of the client area of the control.
Definition: control.h:342
virtual drawing::point location() const
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
Definition: control.h:515
event< control, paint_event_handler > paint
Occurs when the control is redrawn.
Definition: control.h:1373
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition: bitmap.h:11

◆ parent_changed

event<control, event_handler> xtd::forms::control::parent_changed

Occurs when the value of the parent property changes.

Remarks
This event is raised if the parent property is changed by either a programmatic modification or user interaction.

◆ progress_changed

event<background_worker, progress_changed_event_handler> xtd::forms::background_worker::progress_changed

Occurs when report_progress(int32_t) is called.

◆ read_only_changed

event<text_box_base, event_handler> xtd::forms::text_box_base::read_only_changed

Occurs when the value of the read_only property has changed.

◆ resize

event<control, event_handler> xtd::forms::control::resize

Occurs when the control is resized.

Remarks
To determine the size of the resized control, you can cast the sender parameter of the registered control_event_handler method to a control and get its size property (or height and width properties individually).
To handle custom layouts, use the layout event instead of the resize event. The layout event is raised in response to a resize event, but also in response to other changes that affect the layout of the control.
Examples
The following code example demonstrate the use of control resize event.
#include <xtd/xtd>
using namespace std::literals;
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
dot_matrix_display1.height(250);
dot_matrix_display1.location({(client_size().width() - dot_matrix_display1.width()) / 2, (client_size().height() - dot_matrix_display1.height()) / 2});
dot_matrix_display1.parent(*this);
dot_matrix_display1.fore_color(color::red);
dot_matrix_display1.anchor(anchor_styles::top|anchor_styles::bottom);
timer1.interval(300ms);
timer1.enabled(true);
timer1.tick += [&] {
dot_matrix_display1.dot_matrix_style(dot_matrix_styles[(counter / chaser.size()) % dot_matrix_styles.size()]);
dot_matrix_display1.set_dots(chaser[counter++ % chaser.size()]);
};
back_color(color::average(color::black, dot_matrix_display1.fore_color(), 0.20));
text("Dot matrix display example");
resize += [&] {
dot_matrix_display1.left((client_size().width() - dot_matrix_display1.width()) / 2);
};
}
private:
int counter = 0;
std::vector<dot_matrix_display::points_collection> chaser = {
{},
{{3, 3}},
{{3, 3}, {2, 2}, {2, 3}, {2, 4}, {3, 2}, {3, 4}, {4, 2}, {4, 3}, {4, 4}},
{{3, 3}, {2, 2}, {2, 3}, {2, 4}, {3, 2}, {3, 4}, {4, 2}, {4, 3}, {4, 4}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 1}, {2, 5}, {3, 1}, {3, 5}, {4, 1}, {4, 5}, {5, 1}, {5, 2}, {5, 3}, {5, 4}, {5, 5}},
{{3, 3}, {2, 2}, {2, 3}, {2, 4}, {3, 2}, {3, 4}, {4, 2}, {4, 3}, {4, 4}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 1}, {2, 5}, {3, 1}, {3, 5}, {4, 1}, {4, 5}, {5, 1}, {5, 2}, {5, 3}, {5, 4}, {5, 5}, {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {1, 0}, {1, 6}, {2, 0}, {2, 6}, {3, 0}, {3, 6}, {4, 0}, {4, 6}, {5, 0}, {5, 6}, {6, 0}, {6, 1}, {6, 2}, {6, 3}, {6, 4}, {6, 5}, {6, 6}},
};
dot_matrix_display dot_matrix_display1;
std::vector<dot_matrix_style> dot_matrix_styles = {
};
timer timer1;
};
int main() {
application::run(form1());
}
int32_t width() const
Gets the horizontal component of this Size class.
Definition: size.h:67
int32_t height() const
Gets he vertical component of this Size Class.
Definition: size.h:57
virtual drawing::color back_color() const
Gets the background color for the control.
virtual int32_t width() const
Gets the width of the control.
Definition: control.h:682
event< control, event_handler > resize
Occurs when the control is resized.
Definition: control.h:1387
@ dot_matrix_display
Dot matrix display style.
@ bottom
The parent form of this multiple document interface (MDI) form is closing.
@ top
The operating system is closing all applications before shutting down.
@ square
Square dot matrix style.
@ standard
Standard (or round) dot matrix style.

◆ run_worker_completed

event<background_worker, run_worker_completed_event_handler> xtd::forms::background_worker::run_worker_completed

Occurs when the background operation has completed, has been canceled, or has raised an exception.

◆ scroll [1/3]

event<scroll_bar, event_handler> xtd::forms::scroll_bar::scroll

Occurs when the scroll box has been moved by either a mouse or keyboard action.

◆ scroll [2/3]

event<track_bar, event_handler> xtd::forms::track_bar::scroll

Occurs when either a mouse or keyboard action moves the scroll box.

◆ scroll [3/3]

event<up_down_button, event_handler> xtd::forms::up_down_button::scroll

Occurs when either a mouse or keyboard action moves the scroll box.

◆ selected_index_changed [1/2]

event<list_control, event_handler> xtd::forms::list_control::selected_index_changed

Occurs when the selected_index property changes.

◆ selected_index_changed [2/2]

event<tab_control, event_handler> xtd::forms::tab_control::selected_index_changed

Occurs when the selected_index property has changed.

◆ selected_item_changed

event<domain_up_down, event_handler> xtd::forms::domain_up_down::selected_item_changed

Occurs when the selected_item property has been changed.

◆ selected_value_changed

event<list_control, event_handler> xtd::forms::list_control::selected_value_changed

Occurs when the selected_value property changes.

◆ size_changed

event<control, event_handler> xtd::forms::control::size_changed

Occurs when the value of the size property changes.

Remarks
This event is raised if the size property is changed by either a programmatic modification or user interaction.

◆ text_changed

event<control, event_handler> xtd::forms::control::text_changed

Occurs when the value of the text property changes.

Remarks
This event is raised if the text property is changed by either a programmatic modification or user interaction.

◆ thread_exit [1/2]

event<application, delegate<void(const event_args&)> > xtd::forms::application::thread_exit
static

Occurs when a thread is about to shut down. When the main thread for an application is about to be shut down, this event is raised first, followed by an application_exit event.

Remarks
You must attach the event handlers to the thread_exit event to perform any unhandled, required tasks before the thread stops running. Close files opened by this thread, or dispose of objects that the garbage collector did not reclaim.

◆ thread_exit [2/2]

event<application_context, event_handler> xtd::forms::application_context::thread_exit

Occurs when the message loop of the thread should be terminated, by calling exit_thread().

◆ tick

event<timer, event_handler> xtd::forms::timer::tick

Occurs when the specified timer interval has elapsed and the timer is enabled.

Remarks
Calling the Assert method on the xtd::diagnostics::debug class from within the tick event may not behave as expected, as displaying the assertion dialog box may cause Windows to raise the tick event repeatedly. We recommend that you refrain from testing assertions within this event, and use the write, write_if, write_line, or write_line_if methods instead.

◆ updated

xtd::event<animation, animation_updated_event_handler> xtd::forms::animation::updated

Occurs when the specified interval specified by xtd::animation::frames_per_seconds has elapsed and the animation is started.

Remarks
You can use this event to do things like advancing animation parameters, checking the mouse position, etc.

◆ value_changed [1/6]

event<date_time_picker, event_handler> xtd::forms::date_time_picker::value_changed

Occurs when the value of the value property changes.

◆ value_changed [2/6]

event<domain_up_down, event_handler> xtd::forms::domain_up_down::value_changed

Occurs when the value property has been changed.

◆ value_changed [3/6]

event<numeric_up_down, event_handler> xtd::forms::numeric_up_down::value_changed

Occurs when the value property has been changed in some way.

◆ value_changed [4/6]

event<scroll_bar, event_handler> xtd::forms::scroll_bar::value_changed

Occurs when the xtd::forms::scroll_bar::value property is changed, either by a xtd::forms::scroll_bar::scroll event or programmatically.

◆ value_changed [5/6]

event<track_bar, event_handler> xtd::forms::track_bar::value_changed

Occurs when the value property of a track bar changes, either by movement of the scroll box or by manipulation in code.

◆ value_changed [6/6]

event<up_down_button, event_handler> xtd::forms::up_down_button::value_changed

Occurs when the value of the value property changes.

◆ visible_changed

event<control, event_handler> xtd::forms::control::visible_changed

Occurs when the value of the visible property changes.

Remarks
This event is raised if the visible property is changed by either a programmatic modification or user interaction.