I've a wx.Notebook,
starting at page 0,
with on the second page a treectrl, derived from CustomTreeCtrl.
On the pagechanging event of the Notebook,
if the new page is that second page,
I re-generate the CustomTreeCtrl (because it's contents is probably changed).
But the treecntrl is not properly displayed.
def OnPageChanging ( self, event ):
new = event.GetSelection()
if new == 1:
self.Tree.Redraw_JAL_vars () # here the tree is regenerated
event.Skip()
The only refresh / redraw / update for a tree I could find was RefreshSubtree:
self.RefreshSubtree(self.root)
but that makes the "redrawing" even worse.
What's the correct way to "refresh" the graphical representation of the treecntr ?
I've a wx.Notebook,
starting at page 0,
with on the second page a treectrl, derived from CustomTreeCtrl.
On the pagechanging event of the Notebook,
if the new page is that second page,
I re-generate the CustomTreeCtrl (because it's contents is probably changed).
But the treecntrl is not properly displayed.
In what way?
def OnPageChanging ( self, event ):
new = event.GetSelection()
if new == 1:
self.Tree.Redraw_JAL_vars () # here the tree is regenerated
event.Skip()
The only refresh / redraw / update for a tree I could find was RefreshSubtree:
self.RefreshSubtree(self.root)
but that makes the "redrawing" even worse.
What's the correct way to "refresh" the graphical representation of the treecntr ?
It depends on what you mean by "refresh", (redraw, resize, layout, change content, flash everything pink and blue, etc.) and probably also what you mean by "here the tree is regenerated"
I've a wx.Notebook,
starting at page 0,
with on the second page a treectrl, derived from CustomTreeCtrl.
On the pagechanging event of the Notebook,
if the new page is that second page,
I re-generate the CustomTreeCtrl (because it's contents is probably changed).
But the treecntrl is not properly displayed.
In what way?
The tree is not drawn correctly:
Some Nodes get subnodes, but the "+" symbol is not shown, so it looks as if there are no subnodes.
def OnPageChanging ( self, event ):
new = event.GetSelection()
if new == 1:
self.Tree.Redraw_JAL_vars () # here the tree is regenerated
event.Skip()
The only refresh / redraw / update for a tree I could find was RefreshSubtree:
self.RefreshSubtree(self.root)
but that makes the "redrawing" even worse.
What's the correct way to "refresh" the graphical representation of the treecntr ?
It depends on what you mean by "refresh", (redraw, resize, layout, change content, flash everything pink and blue, etc.) and probably also what you mean by "here the tree is regenerated"
Aha, that's the solution
The OnPageChanging.event has to my humble opinion a bug,
both the event.GetSelection() and event.GetOldSelection() points to the old selected tab,
while I would expect (and see in all other languages) that there is parameter in which I can see the new selection,
so I can prevent the new selection or prepare the new page.
I now moved the tree calculation to the OnPageChanged event,
and everything works perfect.