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:
@@ -82,7 +82,10 @@ bool wxButton::Create(wxWindow *parent,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
wxString label(lbl);
|
||||
wxString label;
|
||||
if ( !(style & wxBU_NOTEXT) )
|
||||
{
|
||||
label = lbl;
|
||||
if (label.empty() && wxIsStockID(id))
|
||||
{
|
||||
// On Windows, some buttons aren't supposed to have mnemonics
|
||||
@@ -94,6 +97,7 @@ bool wxButton::Create(wxWindow *parent,
|
||||
: wxSTOCK_WITH_MNEMONIC
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
|
||||
return false;
|
||||
|
@@ -69,6 +69,8 @@ bool wxButton::Create(wxWindow *parent,
|
||||
|
||||
wxString label;
|
||||
|
||||
if ( !(style & wxBU_NOTEXT) )
|
||||
{
|
||||
// Ignore the standard label for help buttons if possible, they use "?"
|
||||
// label under Mac which looks better.
|
||||
if ( !IsHelpButtonWithStandardLabel(id, labelOrig) )
|
||||
@@ -76,6 +78,7 @@ bool wxButton::Create(wxWindow *parent,
|
||||
label = labelOrig.empty() && wxIsStockID(id) ? wxGetStockLabel(id)
|
||||
: labelOrig;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) )
|
||||
|
Reference in New Issue
Block a user