- [super initWithFrame:frame];
- impl = NULL;
- [self setTarget: self];
- [self setAction: @selector(clickedAction:)];
- return self;
-}
-
-- (void) clickedAction: (id) sender
-{
- if ( impl )
+ static BOOL initialized = NO;
+ if (!initialized)
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
- if ( [m_osxView isKindOfClass:[NSButton class]] )
- [(NSButton*)m_osxView setKeyEquivalent: isDefault ? @"\r" : nil ];
+ if ( isDefault && [m_osxView isKindOfClass:[NSButton class]] )
+ // NOTE: setKeyEquivalent: nil will trigger an assert
+ // instead do not call in that case.
+ [(NSButton*)m_osxView setKeyEquivalent: @"\r" ];
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
[v setBezelStyle:NSDisclosureBezelStyle];
[v setButtonType:NSOnOffButton];
[v setTitle:wxCFStringRef( label).AsNSString()];
[v setImagePosition:NSImageRight];
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
[v setBezelStyle:NSDisclosureBezelStyle];
[v setButtonType:NSOnOffButton];
[v setTitle:wxCFStringRef( label).AsNSString()];
[v setImagePosition:NSImageRight];