notebook selection

Folks

Why is this so? I have a notebook with three pages. If I delete the
zeroth page, in the OnSelChange function self.GetSelection(self.GetSelection() (and evt.GetSelection) is 1 and
evt.GetOldSelection() is 0. If I use the self.GetPage(self.GetSelection())
I get the wrong page. I get the third page (2) which is now in the second
spot or index 1.

I have attached a demo file. Add some pages and delete them and you get
the wrong page. I tried to get the correct index in an OnIdle but it stays
incorrect until a tab is selected.

Any help would be appreciated.

Nigel

notebookedit.py (3.86 KB)

Nigel Moriarty wrote:

Folks

Why is this so? I have a notebook with three pages. If I delete the
zeroth page, in the OnSelChange function self.GetSelection(self.GetSelection() (and evt.GetSelection) is 1 and
evt.GetOldSelection() is 0. If I use the self.GetPage(self.GetSelection())
I get the wrong page. I get the third page (2) which is now in the second
spot or index 1.

I have attached a demo file. Add some pages and delete them and you get
the wrong page. I tried to get the correct index in an OnIdle but it stays
incorrect until a tab is selected.

Any help would be appreciated.

I've seen this before. The workaround is to programatically select tab one beofre deleting tab zero. If there isn't one there already please enter a bug report about it.

ยทยทยท

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