Ignore initially specified labels for buttons with wxBU_NOTEXT
It doesn't make much sense to specify a non-empty label and wxBU_NOTEXT style together, but if this happens, the label should be ignored, as it was already done by wxGTK, but not wxMSW and wxOSX -- so add the missing checks for wxBU_NOTEXT to these ports too. Closes #17152.
This commit is contained in:
parent
a0548db9f5
commit
9b39ffc0cb
@ -82,17 +82,21 @@ bool wxButton::Create(wxWindow *parent,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
wxString label(lbl);
|
||||
if (label.empty() && wxIsStockID(id))
|
||||
wxString label;
|
||||
if ( !(style & wxBU_NOTEXT) )
|
||||
{
|
||||
// On Windows, some buttons aren't supposed to have mnemonics
|
||||
label = wxGetStockLabel
|
||||
(
|
||||
id,
|
||||
id == wxID_OK || id == wxID_CANCEL || id == wxID_CLOSE
|
||||
? wxSTOCK_NOFLAGS
|
||||
: wxSTOCK_WITH_MNEMONIC
|
||||
);
|
||||
label = lbl;
|
||||
if (label.empty() && wxIsStockID(id))
|
||||
{
|
||||
// On Windows, some buttons aren't supposed to have mnemonics
|
||||
label = wxGetStockLabel
|
||||
(
|
||||
id,
|
||||
id == wxID_OK || id == wxID_CANCEL || id == wxID_CLOSE
|
||||
? wxSTOCK_NOFLAGS
|
||||
: wxSTOCK_WITH_MNEMONIC
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
|
||||
|
@ -69,12 +69,15 @@ bool wxButton::Create(wxWindow *parent,
|
||||
|
||||
wxString label;
|
||||
|
||||
// Ignore the standard label for help buttons if possible, they use "?"
|
||||
// label under Mac which looks better.
|
||||
if ( !IsHelpButtonWithStandardLabel(id, labelOrig) )
|
||||
if ( !(style & wxBU_NOTEXT) )
|
||||
{
|
||||
label = labelOrig.empty() && wxIsStockID(id) ? wxGetStockLabel(id)
|
||||
: labelOrig;
|
||||
// Ignore the standard label for help buttons if possible, they use "?"
|
||||
// label under Mac which looks better.
|
||||
if ( !IsHelpButtonWithStandardLabel(id, labelOrig) )
|
||||
{
|
||||
label = labelOrig.empty() && wxIsStockID(id) ? wxGetStockLabel(id)
|
||||
: labelOrig;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user