Created
August 2, 2011 01:52
-
-
Save mscottford/1119430 to your computer and use it in GitHub Desktop.
MacRuby IB Outlets and Actions Workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface AppController : NSObject { | |
NSComboBox *seriesCombo; | |
NSComboBox *titleCombo; | |
NSButton *readButton; | |
} | |
@property IBOutlet NSComboBox *seriesCombo; | |
@property IBOutlet NSComboBox *titleCombo; | |
@property IBOutlet NSButton *readButton; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppController.h" | |
@implementation AppController | |
@synthesize seriesCombo; | |
@synthesize titleCombo; | |
@synthesize readButton; | |
- (id)init | |
{ | |
self = [super init]; | |
if (self) { | |
// Initialization code here. | |
} | |
return self; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppController | |
# these items are commented out to prevent hiding the members of the Obj-C version | |
# attr_accessor seriesCombo | |
# attr_accessor titleCombo | |
# attr_accessor readButton | |
def awakeFromNib | |
unless seriesCombo | |
alert 'seriesCombo not defined' | |
end | |
end | |
def alert(title='Alert', message='Something went wrong: ') | |
NSAlert.alertWithMessageText(title, | |
defaultButton: 'OK', | |
alternateButton: nil, | |
otherButton: nil, | |
informativeTextWithFormat: message).runModal | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment