[ wxwindows-Bugs-1769655 ] wxAuiNotebook::InsertPage() leads to
inconsistent state
SourceForge.net
noreply at sourceforge.net
Tue Aug 21 00:43:10 PDT 2007
Bugs item #1769655, was opened at 2007-08-07 20:56
Message generated for change (Comment added) made by juliansmart
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1769655&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: AUI
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Andrey (andrey_yazhuk)
Assigned to: Benjamin I. Williams (biwillia76)
Summary: wxAuiNotebook::InsertPage() leads to inconsistent state
Initial Comment:
Initial report:
Calling wxAuiNotebook::RemovePage(index) and InsertPage(index) and then SetSelection(index) with the same index results in the wrong page being activated. Debugger shows that wxNotebook believes that the right page has already been selected and so SetSelection() call does not do anything. Clicking on the page that should have been selected by SetSelection() also has no effect – tabs do not switch at all, however after a few clicks on other pages the control returns back to normal operation.
It seems that the state of the notebook becomes inconsistent so all attempts to update the control are being ignored. Calling Refresh() or Update() do not change anything.
I found a workaround – before removing a page select some other page, in this case everything works fine.
Clarification:
Why this happens – after call to InsertPage() the active page in the internal tab control still points to the same window, index of this window changes (increments because of the insertion), but m_curpage member is not updated (it should be incremented in this case). Possible solution is to updated m_currpage if needed.
Example :
size_t index = notebook->GetPageIndex(child_w);
notebook->RemovePage(index);
notebook->InsertPage(index, new_page, label);
new_page->Reparent(notebook);
notebook->SetSelection(index);
// at this point notebook indicates that page “index” s selected, however on screen
// page “index +1” appears to be active
----------------------------------------------------------------------
>Comment By: Julian Smart (juliansmart)
Date: 2007-08-21 07:43
Message:
Logged In: YES
user_id=59495
Originator: NO
Applied [ 1777713 ] wxAuiNotebook::InsertPage() - properly update
m_curpage
http://sourceforge.net/tracker/index.php?func=detail&aid=1777713&group_id=9863&atid=309863
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1769655&group_id=9863
More information about the wx-dev
mailing list