Skip to content

Instantly share code, notes, and snippets.

@karlforshaw
Created March 17, 2010 14:26
Show Gist options
  • Save karlforshaw/335280 to your computer and use it in GitHub Desktop.
Save karlforshaw/335280 to your computer and use it in GitHub Desktop.
@implementation WizardController : CPWindowController
{
}
/*
* Instance Init Method
*/
- (WizardController)init
{
var wizardWindow = [[WizardWindow alloc] init];
var self = [super initWithWindow:wizardWindow];
if (self) {
[self initQuestions];
return self;
}
else
alert('Error, could not init Wizard Window');
}
-(CFAction)showWindow:(id)aSender
{
// Super show method
[super showWindow:aSender];
// Don't really like this, but can't see a way around it
var startButton = [self window]._startButton;
[startButton setTarget:self];
[startButton setAction:@selector(nextQuestion)];
}
@end
@implementation WizardWindow : CPPanel
{
CPButton _startButton;
}
- (WizardWindow)init
{
var _startButton = [[CPButton alloc] initWithFrame:CGRectMake(
CGRectGetWidth(bounds) / 2 - 50,
0,
100,
18
)];
[_startButton setTitle:"Start the Wizard"];
[[self contentView] addSubview:_buttonBar];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment