BUG: WxMac and StaticBoxSizers?

Hi,

I am working on an app that consists of a
"mulitsplitter" window with three panes

The top two panels each contain a single
multiline text control and the bottom
panel contains a grid.

I use a static box sizer to emplace a pretty
border around each of the three panels.

The app ( the part that I have done ) works
fine in WinXP and Fedora 6. When I try on the
mac I get evil behavior.

If I click on a different boxed pane to set the focus
to that pane, then the mouse cannot be used
to change the focus to any other boxed pane!

I will try to produce a simpler example but
I suspect (since WinXP and Linux have no problems)
that this is a nasty wxMac but ;(

Thanks,

Jerry

Ohh snap!

Here is an example that make me a liar...This simple
program blows away my hypothesis of a "simple" error.
I can easily move from panel to panel via mouse clicks.

I don't know why the real app is having problems I guess
I will have to try some serious debugging... Still the
app *does* work on Linux and WinXP...

Unfortunately it is rather involved, the top pane
is a sql input area, the second pane is used to report
status of each action and the bottom pane shows the
result of successful queries.

import wx
from wx.lib.splitter import MultiSplitterWindow

class SQLPane(wx.Panel):
     """
     The Status and Error message window
     """
     def __init__(self,parent,colour):
         wx.Panel.__init__(self,parent, style=wx.BORDER_SUNKEN)
         self.SetBackgroundColour(colour)

         box = wx.StaticBox(self,-1,"Status")
         self.theText = wx.TextCtrl(self,style=wx.TE_MULTILINE)
         #sizer=wx.BoxSizer(wx.VERTICAL)
         sizer=wx.StaticBoxSizer(box,wx.VERTICAL)
         sizer.Add(self.theText,1,wx.EXPAND|wx.ALL,1)
         self.SetSizer(sizer)
         sizer.Fit(self)

class myFrame(wx.Frame):
  def __init__(self,parent,id):
    wx.Frame.__init__(self,parent,id,title="BoxSizer problem")
    
class MainWin(wx.Panel):
     def __init__(self, parent):
         wx.Panel.__init__(self, parent, -1)
         splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
         self.splitter = splitter
         sizer = wx.BoxSizer(wx.HORIZONTAL)
         sizer.Add(splitter, 1, wx.EXPAND)
         self.SetSizer(sizer)

         p1=SQLPane(splitter,"light blue")

         splitter.AppendWindow(p1, 160)

         p2 = SQLPane(splitter, "light blue")
         p2.SetMinSize(p2.GetBestSize())
         splitter.AppendWindow(p2, 140)

         p3 = SQLPane(splitter,"light blue")
         splitter.AppendWindow(p3,300)

         self.splitter.SetOrientation(wx.VERTICAL)

if __name__ == '__main__':
     app=wx.PySimpleApp()
     myFrame=myFrame(None,-1)
     myPanel=MainWin(myFrame)
     myFrame.Show()
     app.MainLoop()

···

Begin forwarded message:

From: Jerry LeVan <jerry.levan@gmail.com>
Date: May 19, 2007 10:27:27 PM EDT
To: wxPython-users@lists.wxwidgets.org
Subject: BUG: WxMac and StaticBoxSizers?

Hi,

I am working on an app that consists of a
"mulitsplitter" window with three panes

The top two panels each contain a single
multiline text control and the bottom
panel contains a grid.

I use a static box sizer to emplace a pretty
border around each of the three panels.

The app ( the part that I have done ) works
fine in WinXP and Fedora 6. When I try on the
mac I get evil behavior.

If I click on a different boxed pane to set the focus
to that pane, then the mouse cannot be used
to change the focus to any other boxed pane!

I will try to produce a simpler example but
I suspect (since WinXP and Linux have no problems)
that this is a nasty wxMac but ;(

Thanks,

Jerry

I forgot to mention that if I replace the three
staticBoxSizers with a regular BoxSizer then the
app run fine on the mac ?

After I have lost focus for the top panel by executing
an SQL statement, I can programmatically load a new sql file
via a menu command and if the file is large enough scrollbars
with appear but I cannot move the rascals...

I be baffled ;(

Jerry

···

Begin forwarded message:

From: Jerry LeVan <jerry.levan@gmail.com>
Date: May 19, 2007 10:27:27 PM EDT
To: wxPython-users@lists.wxwidgets.org
Subject: BUG: WxMac and StaticBoxSizers?

Hi,

I am working on an app that consists of a
"mulitsplitter" window with three panes

The top two panels each contain a single
multiline text control and the bottom
panel contains a grid.

I use a static box sizer to emplace a pretty
border around each of the three panels.

The app ( the part that I have done ) works
fine in WinXP and Fedora 6. When I try on the
mac I get evil behavior.

If I click on a different boxed pane to set the focus
to that pane, then the mouse cannot be used
to change the focus to any other boxed pane!

I will try to produce a simpler example but
I suspect (since WinXP and Linux have no problems)
that this is a nasty wxMac but ;(

Thanks,

Jerry

Jerry LeVan wrote:

From: Jerry LeVan <jerry.levan@gmail.com>
Date: May 19, 2007 10:27:27 PM EDT
To: wxPython-users@lists.wxwidgets.org
Subject: BUG: WxMac and StaticBoxSizers?

Hi,

I am working on an app that consists of a
"mulitsplitter" window with three panes

The top two panels each contain a single
multiline text control and the bottom
panel contains a grid.

I use a static box sizer to emplace a pretty
border around each of the three panels.

The app ( the part that I have done ) works
fine in WinXP and Fedora 6. When I try on the
mac I get evil behavior.

If I click on a different boxed pane to set the focus
to that pane, then the mouse cannot be used
to change the focus to any other boxed pane!

I will try to produce a simpler example but
I suspect (since WinXP and Linux have no problems)
that this is a nasty wxMac but ;(

Thanks,

Jerry

I forgot to mention that if I replace the three
staticBoxSizers with a regular BoxSizer then the
app run fine on the mac ?

After I have lost focus for the top panel by executing
an SQL statement, I can programmatically load a new sql file
via a menu command and if the file is large enough scrollbars
with appear but I cannot move the rascals...

The only thing I can think of is that the order that the static box is created relative to the widgets that appear within it makes a difference on the Mac. It needs to be created before the other widgets. Also, make sure that they are all siblings.

···

Begin forwarded message:

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

You are correct! On the Mac the order is *important*.

In the following example ( which sorta mirrors my layout)
The panel creator class AltSQLPane creates the text control
*before* the box.

When the program starts up the cursor is in the top pane.
If one clicks in a different pane then the focus cannot be
reset to the text control in the top pane.

A WAG is that the box is on top of the text control and will not
pass clicks through to the text control beneath the box.

When run under linux there is no problem with the demo!

Thanks,

Jerry

···

On May 20, 2007, at 1:32 AM, Robin Dunn wrote:

Jerry LeVan wrote:

Begin forwarded message:

From: Jerry LeVan <jerry.levan@gmail.com>
Date: May 19, 2007 10:27:27 PM EDT
To: wxPython-users@lists.wxwidgets.org
Subject: BUG: WxMac and StaticBoxSizers?

Hi,

I am working on an app that consists of a
"mulitsplitter" window with three panes

The top two panels each contain a single
multiline text control and the bottom
panel contains a grid.

I use a static box sizer to emplace a pretty
border around each of the three panels.

The app ( the part that I have done ) works
fine in WinXP and Fedora 6. When I try on the
mac I get evil behavior.

If I click on a different boxed pane to set the focus
to that pane, then the mouse cannot be used
to change the focus to any other boxed pane!

I will try to produce a simpler example but
I suspect (since WinXP and Linux have no problems)
that this is a nasty wxMac but ;(

Thanks,

Jerry

I forgot to mention that if I replace the three
staticBoxSizers with a regular BoxSizer then the
app run fine on the mac ?
After I have lost focus for the top panel by executing
an SQL statement, I can programmatically load a new sql file
via a menu command and if the file is large enough scrollbars
with appear but I cannot move the rascals...

The only thing I can think of is that the order that the static box is created relative to the widgets that appear within it makes a difference on the Mac. It needs to be created before the other widgets. Also, make sure that they are all siblings.

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

*********************
#!/usr/bin/env python

import wx
from wx.lib.splitter import MultiSplitterWindow
class AltSQLPane(wx.Panel):
     """
     The Status and Error message window
     """
     def __init__(self,parent,colour):
         wx.Panel.__init__(self,parent, style=wx.BORDER_SUNKEN)
         self.SetBackgroundColour(colour)

         self.theText = wx.TextCtrl(self,style=wx.TE_MULTILINE)

         box = wx.StaticBox(self,-1,"Status")
         #sizer=wx.BoxSizer(wx.VERTICAL)
         sizer=wx.StaticBoxSizer(box,wx.VERTICAL)
         sizer.Add(self.theText,1,wx.EXPAND|wx.ALL,1)
         self.SetSizer(sizer)
         sizer.Fit(self)
class SQLPane(wx.Panel):
     """
     The Status and Error message window
     """
     def __init__(self,parent,colour):
         wx.Panel.__init__(self,parent, style=wx.BORDER_SUNKEN)
         self.SetBackgroundColour(colour)

         box = wx.StaticBox(self,-1,"Status")
         self.theText = wx.TextCtrl(self,style=wx.TE_MULTILINE)
         #sizer=wx.BoxSizer(wx.VERTICAL)
         sizer=wx.StaticBoxSizer(box,wx.VERTICAL)
         sizer.Add(self.theText,1,wx.EXPAND|wx.ALL,1)
         self.SetSizer(sizer)
         sizer.Fit(self)

class myFrame(wx.Frame):
  def __init__(self,parent,id):
    wx.Frame.__init__(self,parent,id,title="BoxSizer problem")
    
class MainWin(wx.Panel):
     def __init__(self, parent):
         wx.Panel.__init__(self, parent, -1)
         splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
         self.splitter = splitter
         sizer = wx.BoxSizer(wx.HORIZONTAL)
         sizer.Add(splitter, 1, wx.EXPAND)
         self.SetSizer(sizer)

         p1=AltSQLPane(splitter,"green")
         splitter.AppendWindow(p1, 160)

         p2 = SQLPane(splitter, "light blue")
         splitter.AppendWindow(p2, 140)

         p3 = SQLPane(splitter,"light blue")
         splitter.AppendWindow(p3,300)

         self.splitter.SetOrientation(wx.VERTICAL)

if __name__ == '__main__':
     app=wx.PySimpleApp()
     myFrame=myFrame(None,-1)
     myPanel=MainWin(myFrame)
     myFrame.Show()
     app.MainLoop()