Remove mnemonics from page text in wxChoicebook and wxListbook

Do it for consistency with the other wxBookCtrl-derived classes.

Document this behaviour.
This commit is contained in:
Vadim Zeitlin
2025-02-24 18:09:00 +01:00
parent 00f5bbbab7
commit 26d2a667b3
4 changed files with 16 additions and 6 deletions
+4
View File
@@ -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
-----------------------------------------------------
+8 -2
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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