Multiline textCTRL used in wxStaticBoxSizer not editable

Hi all,

I am seeing a very strange issue. I am trying to place a simple multiline textCTRL inside a staticboxsizer. I manage to do so, but it is not editable. If I do not make it Multiline, it is editable. Also, I have no problem putting a multiline editable textCTRL outside a staticboxsizer.

To give you a better picture of what I mean, please see the below code:

def create_bulk_test_setup_area(self):
#######################Bulk Test Setup Area####################################

    self.cmtsDevicesTextCtrl = wx.TextCtrl(self, -1, size=(190,100), style=wx.TE_MULTILINE)
    cmtsDetailsStaticBox = wx.StaticBox(self, label = "CMTS Devices")
    cmtsDetailsStaticBoxSizer = wx.StaticBoxSizer(cmtsDetailsStaticBox, wx.VERTICAL)
    cmtsDetailsStaticBoxSizer.Add(self.cmtsDevicesTextCtrl)

    self.rfgwDevicesTextCtrl = wx.TextCtrl(self, -1, size=(190,100), style=wx.TE_MULTILINE)
    rfgwDetailsStaticBox = wx.StaticBox(self, label = "RFGW Devices")
    rfgwDetailsStaticBoxSizer = wx.StaticBoxSizer(rfgwDetailsStaticBox, wx.VERTICAL)
    rfgwDetailsStaticBoxSizer.Add(self.rfgwDevicesTextCtrl)

    self.devicesHBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
    self.devicesHBoxSizer.Add(cmtsDetailsStaticBoxSizer)
    self.devicesHBoxSizer.Add(rfgwDetailsStaticBoxSizer)

It behaves as if I would have specified READONLY, which as you can see is not the case. I am using MAC Maverick.

Any ideas what can be going on?

Thanks,

Dan

Works for me on wxPython 3.0.0-msw (Classic), though I had to add more code since you didn’t post a complete demonstration:

import wx

testtext.py (2.08 KB)

···

#---------------------------------------------------------------------------

class TestFrame(wx.Frame):

def __init__(self, parent, log):

    wx.Frame.__init__(self, parent, -1, "Editors and Renderers Demo", size=(640,480))

    mypnl = myPanel(self, -1)

    mypnl.create_bulk_test_setup_area()

    sizer = wx.BoxSizer(wx.HORIZONTAL)

    sizer.Add(mypnl, 1)

    self.SetSizer(sizer)

class myPanel(wx.Panel):

def create_bulk_test_setup_area(self):

    #######################Bulk Test Setup Area####################################

    self.cmtsDevicesTextCtrl = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)

    cmtsDetailsStaticBox = wx.StaticBox(self, label = "CMTS Devices")

    cmtsDetailsStaticBoxSizer = wx.StaticBoxSizer(cmtsDetailsStaticBox, wx.VERTICAL)

    cmtsDetailsStaticBoxSizer.Add(self.cmtsDevicesTextCtrl,1)

    self.rfgwDevicesTextCtrl = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)

    rfgwDetailsStaticBox = wx.StaticBox(self, label = "RFGW Devices")

    rfgwDetailsStaticBoxSizer = wx.StaticBoxSizer(rfgwDetailsStaticBox, wx.VERTICAL)

    rfgwDetailsStaticBoxSizer.Add(self.rfgwDevicesTextCtrl,1)

    self.rfgwDevicesTextCtrl1 = wx.TextCtrl(self, -1)#, style=wx.TE_MULTILINE)

    rfgwDetailsStaticBox1 = wx.StaticBox(self, label = "RFGW Devices")

    rfgwDetailsStaticBoxSizer1 = wx.StaticBoxSizer(rfgwDetailsStaticBox1, wx.VERTICAL)

    rfgwDetailsStaticBoxSizer1.Add(self.rfgwDevicesTextCtrl1,1)

    self.devicesHBoxSizer = wx.BoxSizer(wx.HORIZONTAL)

    self.devicesHBoxSizer.Add(cmtsDetailsStaticBoxSizer,1)

    self.devicesHBoxSizer.Add(rfgwDetailsStaticBoxSizer,1)

    self.devicesHBoxSizer.Add(rfgwDetailsStaticBoxSizer1,1)

    self.SetSizer(self.devicesHBoxSizer)

#---------------------------------------------------------------------------

if name == ‘main’:

import sys

app = wx.App()

frame = TestFrame(None, sys.stdout)

frame.Show(True)

app.MainLoop()

#---------------------------------------------------------------------------

On Wednesday, November 5, 2014 12:14:12 PM UTC-8, Neamtu Dan wrote:

Hi all,

I am seeing a very strange issue. I am trying to place a simple multiline textCTRL inside a staticboxsizer. I manage to do so, but it is not editable. If I do not make it Multiline, it is editable. Also, I have no problem putting a multiline editable textCTRL outside a staticboxsizer.

To give you a better picture of what I mean, please see the below code:

def create_bulk_test_setup_area(self):
#######################Bulk Test Setup Area####################################

    self.cmtsDevicesTextCtrl = wx.TextCtrl(self, -1, size=(190,100), style=wx.TE_MULTILINE)
    cmtsDetailsStaticBox = wx.StaticBox(self, label = "CMTS Devices")
    cmtsDetailsStaticBoxSizer = wx.StaticBoxSizer(cmtsDetailsStaticBox, wx.VERTICAL)
    cmtsDetailsStaticBoxSizer.Add(self.cmtsDevicesTextCtrl)

    self.rfgwDevicesTextCtrl = wx.TextCtrl(self, -1, size=(190,100), style=wx.TE_MULTILINE)
    rfgwDetailsStaticBox = wx.StaticBox(self, label = "RFGW Devices")
    rfgwDetailsStaticBoxSizer = wx.StaticBoxSizer(rfgwDetailsStaticBox, wx.VERTICAL)
    rfgwDetailsStaticBoxSizer.Add(self.rfgwDevicesTextCtrl)

    self.devicesHBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
    self.devicesHBoxSizer.Add(cmtsDetailsStaticBoxSizer)
    self.devicesHBoxSizer.Add(rfgwDetailsStaticBoxSizer)

It behaves as if I would have specified READONLY, which as you can see is not the case. I am using MAC Maverick.

Any ideas what can be going on?

Thanks,

Dan

Hi Nathan,

Thanks for your reply. This seems to be a Mac only issue.

Running your code with my system (Mac Maverick and Python 2.7.8) shows the same behavior that I initially described. Running it on Windows works fine (and mine does too)

Sorry for not posting the entire code, it was quite a lot and didn’t find a way to do it nice and easy. But the code you have put is very good for testing this, shows the same behavior.

Not sure how to proceed next. Is there anything that can be done to have this working on MAC OS?

···

On Wednesday, November 5, 2014 10:57:56 PM UTC+1, Nathan McCorkle wrote:

Works for me on wxPython 3.0.0-msw (Classic), though I had to add more code since you didn’t post a complete demonstration:

import wx

#---------------------------------------------------------------------------

class TestFrame(wx.Frame):

def __init__(self, parent, log):
    wx.Frame.__init__(self, parent, -1, "Editors and Renderers Demo", size=(640,480))
    mypnl = myPanel(self, -1)
    mypnl.create_bulk_test_setup_area()
    sizer = wx.BoxSizer(wx.HORIZONTAL)
    sizer.Add(mypnl, 1)
    self.SetSizer(sizer)

class myPanel(wx.Panel):

def create_bulk_test_setup_area(self):

    #######################Bulk Test Setup Area####################################
    self.cmtsDevicesTextCtrl = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
    cmtsDetailsStaticBox = wx.StaticBox(self, label = "CMTS Devices")
    cmtsDetailsStaticBoxSizer = wx.StaticBoxSizer(cmtsDetailsStaticBox, wx.VERTICAL)
    cmtsDetailsStaticBoxSizer.Add(self.cmtsDevicesTextCtrl,1)
    self.rfgwDevicesTextCtrl = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE)
    rfgwDetailsStaticBox = wx.StaticBox(self, label = "RFGW Devices")
    rfgwDetailsStaticBoxSizer = wx.StaticBoxSizer(rfgwDetailsStaticBox, wx.VERTICAL)
    rfgwDetailsStaticBoxSizer.Add(self.rfgwDevicesTextCtrl,1)
    self.rfgwDevicesTextCtrl1 = wx.TextCtrl(self, -1)#, style=wx.TE_MULTILINE)
    rfgwDetailsStaticBox1 = wx.StaticBox(self, label = "RFGW Devices")
    rfgwDetailsStaticBoxSizer1 = wx.StaticBoxSizer(rfgwDetailsStaticBox1, wx.VERTICAL)
    rfgwDetailsStaticBoxSizer1.Add(self.rfgwDevicesTextCtrl1,1)
    self.devicesHBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
    self.devicesHBoxSizer.Add(cmtsDetailsStaticBoxSizer,1)
    self.devicesHBoxSizer.Add(rfgwDetailsStaticBoxSizer,1)
    self.devicesHBoxSizer.Add(rfgwDetailsStaticBoxSizer1,1)
    self.SetSizer(self.devicesHBoxSizer)

#---------------------------------------------------------------------------

if name == ‘main’:

import sys
app = wx.App()
frame = TestFrame(None, sys.stdout)
frame.Show(True)
app.MainLoop()

#---------------------------------------------------------------------------

On Wednesday, November 5, 2014 12:14:12 PM UTC-8, Neamtu Dan wrote:

Hi all,

I am seeing a very strange issue. I am trying to place a simple multiline textCTRL inside a staticboxsizer. I manage to do so, but it is not editable. If I do not make it Multiline, it is editable. Also, I have no problem putting a multiline editable textCTRL outside a staticboxsizer.

To give you a better picture of what I mean, please see the below code:

def create_bulk_test_setup_area(self):
#######################Bulk Test Setup Area####################################

    self.cmtsDevicesTextCtrl = wx.TextCtrl(self, -1, size=(190,100), style=wx.TE_MULTILINE)
    cmtsDetailsStaticBox = wx.StaticBox(self, label = "CMTS Devices")
    cmtsDetailsStaticBoxSizer = wx.StaticBoxSizer(cmtsDetailsStaticBox, wx.VERTICAL)
    cmtsDetailsStaticBoxSizer.Add(self.cmtsDevicesTextCtrl)

    self.rfgwDevicesTextCtrl = wx.TextCtrl(self, -1, size=(190,100), style=wx.TE_MULTILINE)
    rfgwDetailsStaticBox = wx.StaticBox(self, label = "RFGW Devices")
    rfgwDetailsStaticBoxSizer = wx.StaticBoxSizer(rfgwDetailsStaticBox, wx.VERTICAL)
    rfgwDetailsStaticBoxSizer.Add(self.rfgwDevicesTextCtrl)

    self.devicesHBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
    self.devicesHBoxSizer.Add(cmtsDetailsStaticBoxSizer)
    self.devicesHBoxSizer.Add(rfgwDetailsStaticBoxSizer)

It behaves as if I would have specified READONLY, which as you can see is not the case. I am using MAC Maverick.

Any ideas what can be going on?

Thanks,

Dan

Hi all,

Can anyone help me on this one?

Thanks,
Dan

Hi Dan,

···

On 11/10/2014 11:08, Neamtu Dan wrote:

Hi all,

Can anyone help me on this one?

Don't have a mac so can't try things out.

Have you tried the two different ways described here?

http://wxpython.org/Phoenix/docs/html/StaticBox.html?highlight=staticbox#StaticBox

If you are on 2.9+ it is the recommended way which should work.

Werner

Based on this conversation, it seems the StaticBox and StaticBoxSizer may need to be created BEFORE the TextCtrl:

https://groups.google.com/d/msg/wxpython-users/4oQCIdQbvOE/lxCklGGlof4J

Try changing the creation order and report back!

···

On Monday, November 10, 2014 2:08:54 AM UTC-8, Neamtu Dan wrote:

Hi all,

Can anyone help me on this one?

Thanks guys, that did the trick! I’d have never thought of that, I appreciate your support!

···

On Monday, November 10, 2014 6:06:57 PM UTC+1, Nathan McCorkle wrote:

On Monday, November 10, 2014 2:08:54 AM UTC-8, Neamtu Dan wrote:

Hi all,

Can anyone help me on this one?

Based on this conversation, it seems the StaticBox and StaticBoxSizer may need to be created BEFORE the TextCtrl:

https://groups.google.com/d/msg/wxpython-users/4oQCIdQbvOE/lxCklGGlof4J

Try changing the creation order and report back!