wx.ScrolledPanel and Disable()

Hello again,

this time I have code for a ScrolledPanel where I add a bunch of custom smaller panels holding a few controls (including NumCtrl from masked lib)
Each panel subclass is initialized with:

wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.SIMPLE_BORDER|wx.TAB_TRAVERSAL)

This SP is laid on another panel, that Disable()s the SP after creation.
When the user makes some selection on another panel through a TreeCtrl, I catch a Right Click event and rebuild the SP with a function that does:
def aggiornaDati(self):
  self.Freeze()
  if len(self.sizerRighe.GetChildren()) > 0:
    self.sizerRighe.DeleteWindows()
  for magRiga in (x.GetDbItem() for x in self.magazzinaggi):
    self.sizerRighe.Add(DdtRientroRiga(self, magRiga), 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
  self.Layout()
  self.Thaw()

on Linux, all the subpanels are correctly drawn in Disabled state, while on Windows they look Enabled but they are actually Disabled (see attached shots)

wx 2.7.1.1

scrolledpanel_linux.png

scrolledpanel_windows.png

···

--
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax +39 0331 35 21 23

Alle lunedì 18 febbraio 2008, Stefano Bartaletti ha scritto:

Hello again,

this time I have code for a ScrolledPanel where I add a bunch of custom
smaller panels holding a few controls (including NumCtrl from masked lib)
Each panel subclass is initialized with:

wx.Panel.__init__(self, parent, wx.ID_ANY,
style=wx.SIMPLE_BORDER|wx.TAB_TRAVERSAL)

This SP is laid on another panel, that Disable()s the SP after creation.
When the user makes some selection on another panel through a TreeCtrl, I
catch a Right Click event and rebuild the SP with a function that does: def
aggiornaDati(self):
  self.Freeze()
  if len(self.sizerRighe.GetChildren()) > 0:
    self.sizerRighe.DeleteWindows()
  for magRiga in (x.GetDbItem() for x in self.magazzinaggi):
    self.sizerRighe.Add(DdtRientroRiga(self, magRiga), 0,
wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) self.Layout()
  self.Thaw()

on Linux, all the subpanels are correctly drawn in Disabled state, while on
Windows they look Enabled but they are actually Disabled (see attached
shots)

wx 2.7.1.1

2.8.7.1, sorry :slight_smile:

···

--
Cordialmente

Stefano Bartaletti
Responsabile Software

G.Tosi Spa Tintoria

Skype account: stefano.bartaletti
ICQ contact : 1271960

Viale dell'Industria 61
21052 Busto Arsizio (VA)

Tel. +39 0331 34 48 11
Fax +39 0331 35 21 23

Stefano Bartaletti wrote:

Hello again,

this time I have code for a ScrolledPanel where I add a bunch of custom smaller panels holding a few controls (including NumCtrl from masked lib)
Each panel subclass is initialized with:

wx.Panel.__init__(self, parent, wx.ID_ANY, style=wx.SIMPLE_BORDER|wx.TAB_TRAVERSAL)

This SP is laid on another panel, that Disable()s the SP after creation. When the user makes some selection on another panel through a TreeCtrl, I catch a Right Click event and rebuild the SP with a function that does:
def aggiornaDati(self):
  self.Freeze()
  if len(self.sizerRighe.GetChildren()) > 0:
    self.sizerRighe.DeleteWindows()
  for magRiga in (x.GetDbItem() for x in self.magazzinaggi):
    self.sizerRighe.Add(DdtRientroRiga(self, magRiga), 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
  self.Layout()
  self.Thaw()

on Linux, all the subpanels are correctly drawn in Disabled state, while on Windows they look Enabled but they are actually Disabled (see attached shots)

Have you tried disabling the new panels after they've been added? How about wrapping SP.Enable()/SP.Disable() around the code above?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!