Hi Michael,
Andrea, can widget stack be used together with wx.AUI or not ? Widget stack
is exactly what I want but I would like to use wx.AUI also because I think
is a bit more elegant.
The idea is that when a tree item is added a new panel must be dynamically
created, so a connection between the tree item and panel is essential.
Panels will contain a grid control and perhaps a few buttons. Cells are
added to grid control depending on user actions.
What is the best approach in this case ?
You can use wxAUI to do that, without problems. I didn't probably
understand your question very well, but you could do something like
that:
1) Create a wx.TreeCtrl on the left (or right, whatever you like),
docking it with wx.AUI:
self._mgr.AddPane(MyTreeControl,
wx.aui.AuiPaneInfo().Left().Caption("My Caption").Name("MyTree")
2) You bind a wx.EVT_TREE_SEL_CHANGED event to catch the item
selection changing:
MyTreeCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged)
def OnSelChanged(self, event):
item = event.GetItem()
# depending on the chosen item do your pre-processing, and then...
oldPane = self._mgr.GetPane("paneYouWantToHide")
oldPane.Hide()
newPane = self._mgr.GetPane("paneYouWantToShow")
newPane.Show() # you can use also CenterPane() or Right() or whatever
self._mgr.Update()
This requires that you build all the panes you need during
initialization. The other approach, suggested by Stef, is that you
create your panes on the fly inside the OnSelChanged event: you can
add them to the wxAUI manager, hide the old one, show the freshly
created one.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On Nov 26, 2007 12:07 PM, michael michael wrote: