demonstrates some events received by form.
#define TRACE
#include <xtd/forms/application>
#include <xtd/forms/trace_form>
#include <xtd/forms/form>
#include <xtd/forms/window_messages>
#include <xtd/ctrace>
class form1 :
public form {
public:
form1() {
text("Form and Messages");
}
protected:
template<typename type_t>
inline static uint16 LOWORD(type_t value) {
return static_cast<uint16>(
static_cast<uint32>(value) & 0xFFFF);
}
template<typename type_t>
inline static uint16 HIWORD(type_t value) {
return static_cast<uint16>((
static_cast<uint32>(value) >> 16) & 0xFFFF);
}
case WM_ACTIVATE: ctrace << string::format(
"WM_ACTIVATE [activate={}]", as<bool>(
message.
lparam())) << environment::new_line;
break;
case WM_CANCELMODE: ctrace <<
"WM_CANCELMODE" << environment::new_line;
break;
case WM_CHILDACTIVATE: ctrace <<
"WM_CHILDACTIVATE" << environment::new_line;
break;
case WM_CLOSE: ctrace <<
"WM_CLOSE" << environment::new_line;
break;
case WM_CREATE: ctrace << string::format(
"WM_CREATE [CREATESTRUCT={}]",
message.
lparam()) << environment::new_line;
break;
case WM_DESTROY: ctrace <<
"WM_DESTROY" << environment::new_line;
break;
case WM_ENTERSIZEMOVE: ctrace <<
"WM_ENTERSIZEMOVE" << environment::new_line;
break;
case WM_ERASEBKGND: ctrace <<
"WM_ERASEBKGNDT" << environment::new_line;
break;
case WM_EXITSIZEMOVE: ctrace <<
"WM_EXITSIZEMOVE" << environment::new_line;
break;
case WM_GETTEXTLENGTH: ctrace <<
"WM_GETTEXTLENGTH" << environment::new_line;
break;
case WM_KILLFOCUS: ctrace <<
"WM_KILLFOCUS" << environment::new_line;
break;
case WM_MOUSEENTER: ctrace << "WM_MOUSEENTER" << environment::new_line; break;
case WM_MOUSELEAVE: ctrace <<
"WM_MOUSELEAVE" << environment::new_line;
break;
case WM_PAINT: ctrace <<
"WM_PAINT" << environment::new_line;
break;
case WM_SETFOCUS: ctrace <<
"WM_SETFOCUS" << environment::new_line;
break;
case WM_SETTEXT: ctrace << string::format(
"WM_SETTEXT [text=\"{}\"]",
reinterpret_cast<char*
>(
message.
lparam())) << environment::new_line;
break;
case WM_SHOWWINDOW: ctrace << string::format(
"WM_SHOWWINDOW [show={}]", as<bool>(
message.
wparam())) << environment::new_line;
break;
case WM_APPIDLE: break;
default: ctrace << string::format(
"[{}]",
message) << environment::new_line;
break;
}
}
};
auto main() -> int {
application::run(form1 {});
}
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.hpp:23
uint16_t uint16
Represents a 16-bit unsigned integer.
Definition uint16.hpp:23
constexpr xtd::uint32 WM_LBUTTONDOWN
Posted when the user presses the left mouse button while the cursor is in the client area of a window...
Definition window_messages.hpp:967
constexpr xtd::uint32 WM_MOUSELEAVE
Posted to a window when the cursor leaves the client area of the window specified in a prior call to ...
Definition window_messages.hpp:1436
constexpr xtd::uint32 WM_SETTEXT
Sets the text of a window.
Definition window_messages.hpp:86
constexpr xtd::uint32 WM_XBUTTONDOWN
Posted when the user presses the first or second X button while the cursor is in the client area of a...
Definition window_messages.hpp:1037
constexpr xtd::uint32 WM_EXITSIZEMOVE
Sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the...
Definition window_messages.hpp:1214
constexpr xtd::uint32 WM_PAINT
The WM_PAINT message is sent when the system or another application makes a request to paint a portio...
Definition window_messages.hpp:107
constexpr xtd::uint32 WM_LBUTTONDBLCLK
Posted when the user double-clicks the left mouse button while the cursor is in the client area of a ...
Definition window_messages.hpp:981
constexpr xtd::uint32 WM_GETTEXTLENGTH
Determines the length, in characters, of the text associated with a window.
Definition window_messages.hpp:100
constexpr xtd::uint32 WM_LBUTTONUP
Posted when the user releases the left mouse button while the cursor is in the client area of a windo...
Definition window_messages.hpp:974
constexpr xtd::uint32 WM_ERASEBKGND
Sent when the window background must be erased (for example, when a window is resized)....
Definition window_messages.hpp:142
constexpr xtd::uint32 WM_CHILDACTIVATE
Sent to a child window when the user clicks the window's title bar or when the window is activated,...
Definition window_messages.hpp:234
constexpr xtd::uint32 WM_MOUSEWHEEL
Sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the m...
Definition window_messages.hpp:1030
constexpr xtd::uint32 WM_KILLFOCUS
Sent to a window immediately before it loses the keyboard focus.
Definition window_messages.hpp:64
constexpr xtd::uint32 WM_RBUTTONDBLCLK
Posted when the user double-clicks the right mouse button while the cursor is in the client area of a...
Definition window_messages.hpp:1002
constexpr xtd::uint32 WM_CREATE
Sent when an application requests that a window be created by calling the CreateWindowEx or CreateWin...
Definition window_messages.hpp:21
constexpr xtd::uint32 WM_XBUTTONDBLCLK
Posted when the user double-clicks the first or second X button while the cursor is in the client are...
Definition window_messages.hpp:1051
constexpr xtd::uint32 WM_MOVE
Sent after a window has been moved.
Definition window_messages.hpp:35
constexpr xtd::uint32 WM_GETTEXT
Copies the text that corresponds to a window into a buffer provided by the caller.
Definition window_messages.hpp:93
constexpr xtd::uint32 WM_XBUTTONUP
Posted when the user releases the first or second X button while the cursor is in the client area of ...
Definition window_messages.hpp:1044
constexpr xtd::uint32 WM_CLOSE
Sent as a signal that a window or an application should terminate.
Definition window_messages.hpp:114
constexpr xtd::uint32 WM_MOUSEMOVE
Posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the ...
Definition window_messages.hpp:960
constexpr xtd::uint32 WM_ENTERSIZEMOVE
Sent one time to a window after it enters the moving or sizing modal loop. The window enters the movi...
Definition window_messages.hpp:1207
constexpr xtd::uint32 WM_ACTIVATEAPP
Sent when a window belonging to a different application than the active window is about to be activat...
Definition window_messages.hpp:192
constexpr xtd::uint32 WM_SETFOCUS
Sent to a window after it has gained the keyboard focus.
Definition window_messages.hpp:57
constexpr xtd::uint32 WM_SIZE
Sent to a window after its size has changed.
Definition window_messages.hpp:43
constexpr xtd::uint32 WM_MBUTTONUP
Posted when the user releases the middle mouse button while the cursor is in the client area of a win...
Definition window_messages.hpp:1016
constexpr xtd::uint32 WM_RBUTTONDOWN
Posted when the user presses the right mouse button while the cursor is in the client area of a windo...
Definition window_messages.hpp:988
constexpr xtd::uint32 WM_DESTROY
Sent when a window is being destroyed. It is sent to the window procedure of the window being destroy...
Definition window_messages.hpp:28
constexpr xtd::uint32 WM_ACTIVATE
Sent to both the window being activated and the window being deactivated. If the windows use the same...
Definition window_messages.hpp:50
constexpr xtd::uint32 WM_COMMAND
Sent when the user selects a command item from a menu, when a control sends a notification message to...
Definition window_messages.hpp:759
constexpr xtd::uint32 WM_MBUTTONDOWN
Posted when the user presses the middle mouse button while the cursor is in the client area of a wind...
Definition window_messages.hpp:1009
constexpr xtd::uint32 WM_CANCELMODE
Sent to cancel certain modes, such as mouse capture. For example, the system sends this message to th...
Definition window_messages.hpp:213
constexpr xtd::uint32 WM_MBUTTONDBLCLK
Posted when the user double-clicks the middle mouse button while the cursor is in the client area of ...
Definition window_messages.hpp:1023
constexpr xtd::uint32 WM_MOUSEHWHEEL
Sent to the active window when the mouse's horizontal scroll wheel is tilted or rotated....
Definition window_messages.hpp:1058
constexpr xtd::uint32 WM_SHOWWINDOW
Sent to a window when the window is about to be hidden or shown.
Definition window_messages.hpp:164
constexpr xtd::uint32 WM_RBUTTONUP
Posted when the user releases the right mouse button while the cursor is in the client area of a wind...
Definition window_messages.hpp:995
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10