[wxPython-users] what's up when all sizers freeze?
Eric Ongerth
ericongerth at gmail.com
Sat Jun 2 11:07:04 PDT 2007
Found it!
Inside of TextCtrlAutoComplete.py, there is this basic handler which happens
to be bound to both wx.EVT_SIZE and wx.EVT_MOVE **not only of itself, but of
all of its parents, grandparents...etc... all the way up the hierarchy**.
gp =3D self
while ( gp !=3D None ) :
gp.Bind ( wx.EVT_MOVE , self.onControlChanged, gp )
gp.Bind ( wx.EVT_SIZE , self.onControlChanged, gp )
gp =3D gp.GetParent()
self.Bind( wx.EVT_KILL_FOCUS, self.onControlChanged, self )
def onControlChanged(self, event):
self._showDropDown( False )
event.Skip()
Well... somewhere in the middle of my working on relatively unrelated stuff
last night, the event.Skip() line got commented out of that routing. I
don't know if it was just a mouse button slip as I was passing by, or what.
But that only little event.Skip() got commented out, and as a result the
TextCtrlAutoComplete holds up an entire branch of my main window.
Everything from there on up is prevented from resizing because
wx.EVT_SIZEis caught by one little control's event handler and not
skipped.
So I'm curious what can be learned from this. One must, of course, be
responsible for one's every move when programming, including accidentally
commenting out even a single line. That is simply part of the trade. But,
with that acknowledged, intuitively I feel that the TextCtrlAutoComplete
should be built a little differently in order to not throw such great
consequences to its whole parent system if the control itself is for some
reason altered. I'm not trying to make a big point here, just taking it as
a learning opportunity.
It strikes me as odd that a control should need to bind its On(self)Changed
method to EVT_MOVE and EVT_SIZE at the level of *each* of its containers /
ancestors. I remember when I first read through the control in order to
start making use of it in my app, that recursive binding section bothered me
a little bit but I decided to get back to that later.
Related thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200706=
02/9d4467b0/attachment.htm
More information about the wxpython-users
mailing list