Treebook size

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Treebook size

Jeff FW
Does anyone know the proper way to change the size (the width, specifically) of the TreeCtrl within a Treebook?  I've tried this (I'm abstracting the containing class out for simplicity as "parent"):

tb = wx.Treebook(parent)
tb.GetTreeCtrl().SetMinSize((250, 0))
tb.GetTreeCtrl().InvalidateBestSize()
parent.SendSizeEvent()

Then, in each notebook page, I have:

    def OnSize(self, event):
        self.SetPosition((260, 0))
        self.SetSize(event.GetSize())
        self.Layout()

which is bound to EVT_SIZE.  This works sometimes in OS X and occasionally half-works in Windows (the notebook pages start at the right position, but the TreeCtrl remains the default size.)  I haven't bothered testing it in Linux yet, as I don't need to support Linux for this app.

Any ideas?

Thanks,
Jeff

_______________________________________________
wxpython-users mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Reply | Threaded
Open this post in threaded view
|

Re: Treebook size

Robin Dunn
Jeff Fein-Worton wrote:

> Does anyone know the proper way to change the size (the width,
> specifically) of the TreeCtrl within a Treebook?  I've tried this (I'm
> abstracting the containing class out for simplicity as "parent"):
>
> tb = wx.Treebook(parent)
> tb.GetTreeCtrl().SetMinSize((250, 0))
> tb.GetTreeCtrl().InvalidateBestSize()
> parent.SendSizeEvent()
>
> Then, in each notebook page, I have:
>
>     def OnSize(self, event):
>         self.SetPosition((260, 0))
>         self.SetSize(event.GetSize())
>         self.Layout()
>
> which is bound to EVT_SIZE.  This works sometimes in OS X and
> occasionally half-works in Windows (the notebook pages start at the
> right position, but the TreeCtrl remains the default size.)  I haven't
> bothered testing it in Linux yet, as I don't need to support Linux for
> this app.

I think I would do it by intercepting the EVT_SIZE event of the
Treebook.  In that handler you can position and size the tree and the
page windows however you want, and if you don't call event.Skip() then
the default handler won't be run.


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

_______________________________________________
wxpython-users mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Reply | Threaded
Open this post in threaded view
|

Re: Treebook size

Jeff FW
In reply to this post by Jeff FW
Jeff Fein-Worton wrote:
Does anyone know the proper way to change the size (the width, specifically) of the TreeCtrl within a Treebook?  I've tried this (I'm abstracting the containing class out for simplicity as "parent"):

tb = wx.Treebook(parent)
tb.GetTreeCtrl().SetMinSize((250, 0))
tb.GetTreeCtrl().InvalidateBestSize()
parent.SendSizeEvent()

Then, in each notebook page, I have:

   def OnSize(self, event):
       self.SetPosition((260, 0))
       self.SetSize(event.GetSize())
       self.Layout()

which is bound to EVT_SIZE.  This works sometimes in OS X and occasionally half-works in Windows (the notebook pages start at the right position, but the TreeCtrl remains the default size.)  I haven't bothered testing it in Linux yet, as I don't need to support Linux for this app.

I think I would do it by intercepting the EVT_SIZE event of the Treebook.  In that handler you can position and size the tree and the page windows however you want, and if you don't call event.Skip() then the default handler won't be run.


Robin--thanks, that worked!  You save the day, as usual.

One thing that threw me off for a bit was that each of the notebook pages are all separate windows directly within the Treebook window, meaning that loop through all of the pages to set their sizes.  It seems like it would be easier to manage that if the pages were stored with in an intermediate window, so you could just set the size of that.  But that's just my 2 cents.

Thanks again,
Jeff

_______________________________________________
wxpython-users mailing list
[hidden email]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Reply | Threaded
Open this post in threaded view
|

Re: Treebook size

herrysugiharto
This post has NOT been accepted by the mailing list yet.
In reply to this post by Robin Dunn
There is no GetTreeCtrl() function in Phoenix's TreeBook.
Is there any alternative way to resize the TreeCtrl of TreeBook?

Thanks.