xtd 0.2.0
Loading...
Searching...
No Matches

◆ lost_focus

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

Occurs when the xtd::forms::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 xtd::forms::control::got_focus and xtd::forms::control::lost_focus events are low-level focus events that are tied to the WM_KILLFOCUS and WM_SETFOCUS Windows messages. Typically, the xtd::forms::control::got_focus and xtd::forms::control::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 xtd::forms::control::enter, xtd::forms::control::got_focus, xtd::forms::control::leave, xtd::forms::control::lost_focus, xtd::forms::control::validating, or xtd::forms::control::validated event handlers. Doing so can cause your application or the operating system to stop responding.
Remarks
For more information about handling events, see Handling and Raising Events.