Skip to content

Instantly share code, notes, and snippets.

@mscottford
Created August 2, 2011 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mscottford/1119430 to your computer and use it in GitHub Desktop.
Save mscottford/1119430 to your computer and use it in GitHub Desktop.
MacRuby IB Outlets and Actions Workaround
#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
#import "AppController.h"
@implementation AppController
@synthesize seriesCombo;
@synthesize titleCombo;
@synthesize readButton;
- (id)init
{
self = [super init];
if (self) {
// Initialization code here.
}
return self;
}
@end
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