diff --git a/docs/changes.txt b/docs/changes.txt index 3ffbd29f8a..f3a08c9d9b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -127,6 +127,10 @@ Changes in behaviour not resulting in compilation errors the page on screen, which doesn't make sense without reference to the tab control containing it, use GetPagePosition() to retrieve both of them. +- wxListbook and wxChoicebook now interpret (but ignore) mnemonics in their + page titles, just as the other wx*book classes already did. Double "&" + in the page text if it should be interpreted as a literal "&". + Changes in behaviour which may result in build errors ----------------------------------------------------- diff --git a/interface/wx/bookctrl.h b/interface/wx/bookctrl.h index 739609049b..75248b6470 100644 --- a/interface/wx/bookctrl.h +++ b/interface/wx/bookctrl.h @@ -139,6 +139,10 @@ public: /** Sets the text for the given page. + + The text may contain mnemonics, i.e. accelerator characters preceded by + the ampersand (`&`) character. If you need to include a literal + ampersand in the text, you need to double it, i.e. use `&&`. */ virtual bool SetPageText(size_t page, const wxString& text) = 0; ///@} @@ -257,7 +261,8 @@ public: @param page Specifies the new page. @param text - Specifies the text for the new page. + Specifies the text of the new page. Note that it may contain + mnemonic characters, see SetPageText() for more information. @param select Specifies whether the page should be selected. @param imageId @@ -297,7 +302,8 @@ public: @param page Specifies the new page. @param text - Specifies the text for the new page. + Specifies the text of the new page. Note that it may contain + mnemonic characters, see SetPageText() for more information. @param select Specifies whether the page should be selected. @param imageId diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index 8400fc1e31..6d02c1848a 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -106,7 +106,7 @@ wxChoicebook::Create(wxWindow *parent, bool wxChoicebook::SetPageText(size_t n, const wxString& strText) { - GetChoiceCtrl()->SetString(n, strText); + GetChoiceCtrl()->SetString(n, RemoveMnemonics(strText)); return true; } @@ -178,7 +178,7 @@ wxChoicebook::InsertPage(size_t n, if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) return false; - GetChoiceCtrl()->Insert(text, n); + GetChoiceCtrl()->Insert(RemoveMnemonics(text), n); // if the inserted page is before the selected one, we must update the // index of the selected page diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 22891be711..ea146dbc5d 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -219,7 +219,7 @@ void wxListbook::UpdateSize() bool wxListbook::SetPageText(size_t n, const wxString& strText) { - GetListView()->SetItemText(n, strText); + GetListView()->SetItemText(n, RemoveMnemonics(strText)); return true; } @@ -320,7 +320,7 @@ wxListbook::InsertPage(size_t n, if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) ) return false; - GetListView()->InsertItem(n, text, imageId); + GetListView()->InsertItem(n, RemoveMnemonics(text), imageId); // if the inserted page is before the selected one, we must update the // index of the selected page