Create native buttons without any label in wxOSX/Cocoa

Since the changes of db9baf9aa5 the label wasn't
explicitly reset to be empty on wxWindow creation because it was assumed it
would already be empty if not explicitly set, but this turned out to be false
for the controls using NSButton which (very helpfully) uses "Button" as its
label by default and so kept this useless label if it wasn't explicitly
overridden.

Fix this by explicitly resetting the NSButton title after creating it, to
ensure consistency between the real state of the control and what wxWidgets
thinks it is.

Closes #17152.
This commit is contained in:
Vadim Zeitlin 2015-10-18 03:57:33 +02:00
parent 39db6c42bf
commit ef1db7acda

View File

@ -37,6 +37,18 @@
}
}
- (id) initWithFrame:(NSRect) frame
{
self = [super initWithFrame:frame];
// NSButton uses "Button" as its title by default which is inconvenient as
// wxWidgets expects the control to not have any default label, so reset it
// here to resolve this mismatch.
[self setTitle:@""];
return self;
}
- (int) intValue
{
switch ( [self state] )