Children of a hidden panel on Windows 8.1 show though

Hi,

I have a problem with a panel which has two child panels (A and B), only one of these two are shown depending on data shown.

Panel A shows wine related data and Panel B has spirit related data.

When I select a wine panel 'A' is shown and 'B' is hidden.

All this works fine on Win 7, Win XP and probably also Vista but on 8.1 I have parts of the controls which are on the second hidden panel show through, the controls in question are a custom popup control, which has a wx.StaticText and that is what is showing through. Worse still if I then click on the button which is contained in one of these popup controls on the first panel which is shown the app hard crashes.

The popup control behaves correctly, even on 8.1, on panels which don't have a second hidden panel.

This is with Py2.7.6 and wxPython 2.9.5 and the same with wxPython 3.0.0

Does anyone have any idea what this might be caused by and any suggestions on how I might be able to work around it.

Werner

Hi,

O.k. I found the reason, it actually has nothing to do with 8.1 as it is a bug I introduced in a recent change.

On a side note, I identified the bug using 'hg bisect' which I say is really neat. You might want to check this page out if you haven't used this before:
http://tortoisehg.bitbucket.org/hgbook/1.6/finding-and-fixing-mistakes.html

BTW, git bisect exists too.

O.k. now to my problem. The popup control use EVT_UPDATE_UI and I had this:

         wx.UpdateUIEvent.SetUpdateInterval(500)
         self.Bind(wx.EVT_UPDATE_UI, self.onUpdateUI)

     def onUpdateUI(self, evt): #pylint: disable=W0613
         event_id = evt.GetId()
         if self._dbItemSelected:
             if event_id == self.edit.GetId():
                 evt.Enable(True)
         else:
             if event_id == self.edit.GetId():
                 evt.Enable(False)

Which I changed to the following, i.e. did a bind on the two button's (initially I only was interested in the 'edit' button) I wanted to enable instead of binding to the popup control and using evt.GetId.

         self.add.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIAdd)
         self.edit.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIEdit)

     def onUpdateUIAdd(self, evt): #pylint: disable=W0613
         """The update UI event handler for the 'add' button."""
         # only allow to add parent is not in create mode
         if self.dbParent._isNew:
             evt.Enable(False)
         else:
             evt.Enable(True)

     def onUpdateUIEdit(self, evt): #pylint: disable=W0613
         """The update UI event handler for the 'edit' button."""
         # only allow to edit if an item is selected and parent not in create mode
         event_id = evt.GetId()
         log.debug("onUpdateUIEdit: %s" % event_id)
         if self.dbParent._isNew:
             evt.Enable(False)
         else:
             if self._dbItemSelected:
                 evt.Enable(True)
             else:
                 evt.Enable(False)

I would like to keep the later as I don't want all these events thrown which I don't really do anything with.

Anyone can give me a hint on what I am doing wrong in the later code?

Werner

Hi,

I read through some of the threads about EVT_UPDATE_UI and changed the code to this:

If I comment the first bind below then the problem shows up, even so the corresponding handler does nothing.

          wx.UpdateUIEvent.SetUpdateInterval(500)
         self.Bind(wx.EVT_UPDATE_UI, self.onUpdateUI)

         self.add.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIAdd)
         self.edit.Bind(wx.EVT_UPDATE_UI, self.onUpdateUIEdit)

     def onUpdateUI(self, evt): #pylint: disable=W0613
         """The update UI event handler for the 'add' button."""
         pass

     def onUpdateUIAdd(self, evt): #pylint: disable=W0613
         """The update UI event handler for the 'add' button."""
         # only allow to add parent is not in create mode
         evt.Enable(not self.dbParent._isNew)

     def onUpdateUIEdit(self, evt): #pylint: disable=W0613
         """The update UI event handler for the 'edit' button."""
         # only allow to edit if an item is selected and parent not in create mode
         if self.dbParent._isNew:
             evt.Enable(False)
         else:
             if self._dbItemSelected:
                 evt.Enable(True)
             else:
                 evt.Enable(False)

I can live with this but am really curious why this happens.

Werner