473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 2248
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
1
by: Curzio Basso | last post by:
Hi all, I have a problem for which I wasn't able to find an answer anywhere else, maybe someone can give me a hint... I designed with XRCed a small GUI (the code is at the bottom of the...
6
by: Max | last post by:
I have the following code on a form that launches Microsoft Outlook and creates a new email message for the user: Outlook.Application oApp = new Outlook.Application(); Outlook.MailItem oMail...
6
by: harvie wang | last post by:
Hi, How to send a message to every window(include child window), I use SendMessage ,but It can't do that. class frmA { public const int WM_test = 0x400 + 1; protected override void...
38
by: JTL | last post by:
I have learnt java before and now begin to learn c++ what puzzle me is that seem that different SDKs(c++builder, vs.net, gcc..) has its own class library we know that in java there are only one...
3
by: analfabete | last post by:
Hi everybody ! When I move my windows's program, this windows can leave the screen like all program. But me, I would like to know how I can do to always keep all part of my windows (when I move...
1
by: ndoe | last post by:
what a funtion of EVT_PAINT if i not use that can it work normally for drawing or show a picture
8
by: knkk | last post by:
Instead of an id getting its innerHTML changed, the entire page is getting refreshed with this function of mine (you may want to look just at the end of the function where there's an alert): ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.