Hi,
maybe I wrote my mail too quickly, so that the description of my problem
is not so easy to understand as I wish. So here is a little more explanation:
My TreeCtrl has a method
def self.OnTreeSelectionChange
which is the callback on the event
wx.EVT_TREE_SEL_CHANGED(self, -1, self.OnTreeSelectionChange)
ie it gets called when I click on an item, or when somewhere in the code
I call the tree-control method tree.SelectItem(). Actually this method only prints
“OnTreeSelectionChange”, event.GetId()
This TreeCtrl has also a!
method
self.OnTreeRightClick as callback for
wx.EVT_TREE_ITEM_RIGHT_CLICK(self, -1, self.OnTreeRightClick)
which has the effect to build and popup a menu.
The callback of this menu is the method “OnTreePopupNew” which append an item to the tree
and set the tree selection on this new item through a call to tree.SelectItem(newItem,1):
code
print "OnTreePopupNew S"
self.tree.SelectItem(newItem,1)
print "OnTreePopupNew E"
So I am expecting on stdout the message :
OnTreePopupNew S
OnTreeSelectionChange
OnTreePopupNew E
but what I get is
OnTreePopupNew S
OnTreeSelectionChange
OnTreeSelectionChange ( !
–> why this one ?? )
OnTreePopupNew E
Why do I get “OnTre
eSelectionChange” twice on windows ( not on linux) ??
I would like to avoid this without having to write something like
if ( self.currItem != item ):
self.currItem = item
print “OnTreeSelectionChange”
Thank in advance,
xm
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192