ScrolledPanel on Mac

I'm seeing an issue with using the ScrolledPanel on the Mac where it
always wants to have scroll bars for the full size of the application.
I have a scrolled panel within an aui notebook page and if you resize
the notebook page the scrollbars show up. I've attached an example
app to this email to demonstrate this problem.
Has anyone else seen something like this?

Thanks,
--Mark

TestApp1.py (957 Bytes)

Mark Guagenti wrote:

I'm seeing an issue with using the ScrolledPanel on the Mac where it
always wants to have scroll bars for the full size of the application.
I have a scrolled panel within an aui notebook page and if you resize
the notebook page the scrollbars show up. I've attached an example
app to this email to demonstrate this problem.
Has anyone else seen something like this?

My guess it's because the panel has no content and no sizer, so the virtual size is being set to the current size. After resizing there could be some mismatch between the current size and the current virtual size depending on what order the events are processed.

···

--
Robin Dunn
Software Craftsman

I originally had content and a sizer in the example but tried to
simplify it to much I guess. I'm seeing this problem in a much bigger
app with more content, and this was the simplest I could make it to
demonstrate the problem. I'm still seeing it with the following code:
import wx
import wx.aui
from wx.lib.scrolledpanel import ScrolledPanel

class TestScrollPanel(ScrolledPanel):
    def __init__(self, parent):
        ScrolledPanel.__init__(self, parent)
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)

        lst = wx.ListCtrl(self)
        lst.InsertStringItem(0, "test")
        main_sizer.Add(lst, 1, wx.EXPAND)

        self.SetSizerAndFit(main_sizer)
        self.SetupScrolling()

class TestFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None)
        self.notebook = wx.aui.AuiNotebook(self)
        self.notebook.InsertPage(self.notebook.GetPageCount(),
TestScrollPanel(self.notebook), "Test ScrollPanel")
        panel = wx.Panel(self.notebook)
        self.notebook.InsertPage(self.notebook.GetPageCount(), panel,
"Test Panel")
        self.notebook.Split(self.notebook.GetPageIndex(panel), wx.HORIZONTAL)

if __name__ == '__main__':
    app = wx.App()
    app.frame = TestFrame()
    app.frame.Show()
    app.MainLoop()

···

On Mon, May 11, 2009 at 10:14 PM, Robin Dunn <robin@alldunn.com> wrote:

Mark Guagenti wrote:

I'm seeing an issue with using the ScrolledPanel on the Mac where it
always wants to have scroll bars for the full size of the application.
I have a scrolled panel within an aui notebook page and if you resize
the notebook page the scrollbars show up. I've attached an example
app to this email to demonstrate this problem.
Has anyone else seen something like this?

My guess it's because the panel has no content and no sizer, so the virtual
size is being set to the current size. After resizing there could be some
mismatch between the current size and the current virtual size depending on
what order the events are processed.

--
Robin Dunn
Software Craftsman
http://wxPython.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Mark Guagenti wrote:

I originally had content and a sizer in the example but tried to
simplify it to much I guess. I'm seeing this problem in a much bigger
app with more content, and this was the simplest I could make it to
demonstrate the problem. I'm still seeing it with the following code:

Add the WIT and you can see that the listctrl's best size is always reset to be it's current size. That means that the sizer will try to not let it get smaller than that size so since it's in a ScrolledPanel the panel's scrollbars are shown. You can work around this by setting the listctrl's minsize to some small size.

···

--
Robin Dunn
Software Craftsman

Worked great, thanks!
--Mark

···

On Wed, May 13, 2009 at 9:39 PM, Robin Dunn <robin@alldunn.com> wrote:

Mark Guagenti wrote:

I originally had content and a sizer in the example but tried to
simplify it to much I guess. I'm seeing this problem in a much bigger
app with more content, and this was the simplest I could make it to
demonstrate the problem. I'm still seeing it with the following code:

Add the WIT and you can see that the listctrl's best size is always reset to
be it's current size. That means that the sizer will try to not let it get
smaller than that size so since it's in a ScrolledPanel the panel's
scrollbars are shown. You can work around this by setting the listctrl's
minsize to some small size.

--
Robin Dunn
Software Craftsman
http://wxPython.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users