On Tue, 12 Jun 2012 01:17:37 -0700 (PDT) ardi wrote:
a> On Monday, June 11, 2012 8:01:50 PM UTC+2, Vadim Zeitlin wrote:
a> > The alternative in this question is incorrect anyhow. Of course you
a> > wouldn't expect to start dragging a view which had never been clicked. The
a> > fact that it happens in the sample is just a bug in the sample code, as I
a> > wrote it just checks that the mouse is being dragged but not that we
a> > actually started dragging it in this window. This is definitely wrong.
a> >
a> Hmm... this confuses me... do you mean that if a canvas gets a mouse motion
a> event it must first check if such event belongs to it or to another
a> canvas?... events received by a widget are supposed to belong to it, don't
a> they?
Yes, they are but the sample doesn't check for motion events. It checks
for dragging events, i.e. motion events with a mouse button being pressed
down. And this is wrong because if you pressed the button outside of the
window and then moved the mouse into the window, it shouldn't count as
dragging event.
a> For example, if I start dragging on a button and the cursor moves over
a> another button, does the second receive a dragging event?
No because the first button captures the mouse and so gets all mouse
events until it releases the mouse.
a> Anyway, it now works for me, by explicitly calling CaptureMouse() when
a> compiling on MSW.
I can only repeat that IMO you should do this under all platforms. This
might work without CaptureMouse() under Mac and even GTK (although AFAIU
you didn't test this there) right now but it could change in the future.
With CaptureMouse() it should always work.