Just for information. Maybe the cause is not in the Windows Tree control.
Below is a log of two SEL_CHANGED events that happen after programmatic
selection of added items.
'old' is the result of event.GetOldItem();
'cur' is the result of event.GetItem();
'sel' is the result of tree.GetSelection()
Interesting, that:
Second event's current item is the first events old item;
Second event's old item is invalid.
Add node
---- selection change event -----
old: <C wxTreeItemId instance at _e7e058_wxTreeItemId_p> old.IsOk(): 1
cur: <C wxTreeItemId instance at _d369e0_wxTreeItemId_p> cur.IsOk(): 1
sel: <C wxTreeItemId instance at _e5fc48_wxTreeItemId_p> sel.IsOk(): 1
old==cur: 0
cur==sel: 1
old==sel: 0
---- selection change event -----
old: <C wxTreeItemId instance at _e85f18_wxTreeItemId_p> old.IsOk(): 0
cur: <C wxTreeItemId instance at _e7e058_wxTreeItemId_p> cur.IsOk(): 1
sel: <C wxTreeItemId instance at _e5fc48_wxTreeItemId_p> sel.IsOk(): 1
old==cur: 0
cur==sel: 1
old==sel: 0
By the way, what about vetoing the events?
Peteris Martinsons