Mouse position is reported wrong when mouse is captured and moved beyond the client area (left and top direction)
Posted: 09 Jun 2017, 09:21
I attached mouse event handlers as follows (image is a framework element of type Image, 'this' is an MFC CWnd)
Then if I drag my mouse starting from inside the image, to the left, then go beyond the client area of the window, NoesisGUI calls the Mouse Move handler with wrong values. Below is the trace of the printf inside Mouse Move handler. You can observe that instead of giving negative value for the x coordinate beyond the client area on the left, NoesisGUI gives 65000+ values. Seems that it wraps around an unsigned short value internally.
Code: Select all
image->MouseMove() += [=](BaseComponent* sender, const MouseEventArgs& args) {
printf("MousePos %4.2f %4.2fn", args.position.x, args.position.y);
};
image->MouseLeftButtonDown() += [=](BaseComponent* sender, const MouseButtonEventArgs& args) {
image->CaptureMouse();
this->SetCapture();
};
image->MouseLeftButtonUp() += [=](BaseComponent* sender, const MouseButtonEventArgs& args) {
image->ReleaseMouseCapture();
::ReleaseCapture();
};
MousePos 60.00 183.00
MousePos 58.00 183.00
MousePos 57.00 182.00
MousePos 53.00 182.00
MousePos 51.00 182.00
MousePos 48.00 181.00
MousePos 46.00 181.00
MousePos 44.00 180.00
MousePos 42.00 180.00
MousePos 40.00 180.00
MousePos 36.00 179.00
MousePos 35.00 178.00
MousePos 33.00 178.00
MousePos 30.00 178.00
MousePos 29.00 178.00
MousePos 26.00 178.00
MousePos 25.00 178.00
MousePos 19.00 176.00
MousePos 16.00 176.00
MousePos 13.00 175.00
MousePos 1.00 175.00
MousePos 65535.00 175.00
MousePos 65534.00 174.00
MousePos 65533.00 174.00
MousePos 65532.00 174.00
MousePos 65531.00 174.00
MousePos 65529.00 174.00