472,127 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Why does wx.Window.CaptureMouse() send EVT_PAINT

It seems that the CaptureMouse method sends an EVT_PAINT handler. The
documentation does not mention this...is it somewhere else? Could
someone explain why this handler is sent out?

Also, I've seen:

def OnMouseDown(self, evt):
self.CaptureMouse()
self.x, self.y = self.lastx, self.lasty = evt.GetPosition()
self.Refresh(False)

Given that CaptureMouse initiates a repaint, isn't self.Refresh(False)
moot at the point.

Thanks. The doc for CaptureMouse are below.

---------

CaptureMouse(self)

Directs all mouse input to this window. Call wx.Window.ReleaseMouse to
release the capture.

Note that wxWindows maintains the stack of windows having captured the
mouse and when the mouse is released the capture returns to the window
which had had captured it previously and it is only really released if
there were no previous window. In particular, this means that you must
release the mouse as many times as you capture it, unless the window
receives the wx.MouseCaptureLostEvent event.

Any application which captures the mouse in the beginning of some
operation must handle wx.MouseCaptureLostEvent and cancel this operation
when it receives the event. The event handler must not recapture mouse.
Dec 7 '06 #1
2 2199
Bill Jackson <ja*****@hotmail.comwrote:
>
It seems that the CaptureMouse method sends an EVT_PAINT handler. The
documentation does not mention this...is it somewhere else? Could
someone explain why this handler is sent out?
The source code could answer that question for sure, but I doubt that it is
CaptureMouse doing it, and I know the SetCapture API (which it eventually
calls) does not. Is it possible that your clicking caused some part of the
app to become unhidden, or caused some button to change state?
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Dec 10 '06 #2
Tim Roberts wrote the following on 12/09/2006 08:27 PM:
The source code could answer that question for sure, but I doubt that it is
CaptureMouse doing it, and I know the SetCapture API (which it eventually
calls) does not. Is it possible that your clicking caused some part of the
app to become unhidden, or caused some button to change state?
Indeed. The EVT_PAINT came from self.Refresh(False). I mistakenly
thought that False implied that it would not refresh, but the docs
clearly state (which I had not read) otherwise. To reiterate,
CaptureMouse does not send an EVT_PAINT.
Dec 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Curzio Basso | last post: by
6 posts views Thread by Max | last post: by
38 posts views Thread by JTL | last post: by
1 post views Thread by ndoe | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.