StaticBox/StaticBoxSizer Problem with 2.5.2.7 ?

Hello,

when using StaticBox and StaticBoxSizer in a dialog under Mac OSX / 2.5.2.7 the Controls inside the box are visible but not available. The same code with 2.5.1.5 goes well.

Wolfgang

Wolfgang wrote:

Hello,

when using StaticBox and StaticBoxSizer in a dialog under Mac OSX / 2.5.2.7 the Controls inside the box are visible but not available. The

Is the static box created before the controls within it? (It should be.)

···

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

Hi Wolfgang,

Are you creating the static box, or its controls, first? Since wxStaticBox cannot have children, the "siblings" must be created *after* the static box to ensure they are "on top of" the static box.

HTH,

Kevin

···

On Aug 17, 2004, at 9:05 AM, Wolfgang wrote:

Hello,

when using StaticBox and StaticBoxSizer in a dialog under Mac OSX / 2.5.2.7 the Controls inside the box are visible but not available. The same code with 2.5.1.5 goes well.

Wolfgang

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org

Thank you all - that was the solution:

-- code --

import wx # This module uses the new wx namespace

class TestDialog(wx.Dialog):

     def __init__(self, parent, call_fit = True, set_sizer = True):
         wx.Dialog.__init__(self, parent, -1, "Test")

         item0 = wx.BoxSizer(wx.VERTICAL)

         # -- Controls --
         box1 = wx.StaticBox(self, -1, "Staticbox") # <-- here is the correct place
         self.cb1 = wx.CheckBox(self, -1, "Checkbox 1")
         self.cb2 = wx.CheckBox(self, -1, "Checkbox 2")
         self.cb3 = wx.CheckBox(self, -1, "Checkbox 3")
         self.cb4 = wx.CheckBox(self, -1, "Checkbox 4")

         # -- Values --
         self.cb1.SetValue(True)
         self.cb2.SetValue(False)
         self.cb3.SetValue(True)
         self.cb4.SetValue(False)

         # -- Layout --
         #box1 = wx.StaticBox(self, -1, "Staticbox") # <-- not here !!!
         boxsizer1 = wx.StaticBoxSizer(box1, wx.VERTICAL)
         boxsizer1.Add(self.cb1, 0, wx.ALL, 5)
         boxsizer1.Add(self.cb2, 0, wx.ALL, 5)
         item0.Add(boxsizer1, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

         item0.Add(self.cb3, 0, wx.ALL, 5)
         item0.Add(self.cb4, 0, wx.ALL, 5)

         item2 = wx.StaticLine(self, -1, wx.DefaultPosition, wx.Size(40,-1), wx.LI_HORIZONTAL)
         item0.Add(item2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

         item3 = wx.BoxSizer(wx.HORIZONTAL)

         self.btn1 = wx.Button(self, wx.ID_OK, "OK", wx.DefaultPosition, (80,-1), 0)
         self.btn1.SetDefault()
         item3.Add(self.btn1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

         item0.Add(item3, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.BOTTOM, 5)

         if set_sizer == True:
             self.SetAutoLayout(True)
             self.SetSizer(item0)
             if call_fit == True:
                 item0.Fit(self)
                 item0.SetSizeHints(self)

#if __name__ == '__main__':
app = wx.PySimpleApp()
frame = wx.Frame(None, -1, "Just one child")
dlg = TestDialog(frame)
dlg.ShowModal()
dlg.Destroy()
#app.MainLoop()

-- code --

···

Am 17.08.2004 um 19:07 schrieb Kevin Ollivier:

Hi Wolfgang,

Are you creating the static box, or its controls, first? Since wxStaticBox cannot have children, the "siblings" must be created *after* the static box to ensure they are "on top of" the static box.

HTH,

Kevin

On Aug 17, 2004, at 9:05 AM, Wolfgang wrote:

Hello,

when using StaticBox and StaticBoxSizer in a dialog under Mac OSX / 2.5.2.7 the Controls inside the box are visible but not available. The same code with 2.5.1.5 goes well.

Wolfgang

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-dev-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-dev-help@lists.wxwidgets.org