Skip to content

Instantly share code, notes, and snippets.

@allometry
Created March 23, 2009 16:33
Show Gist options
  • Save allometry/83641 to your computer and use it in GitHub Desktop.
Save allometry/83641 to your computer and use it in GitHub Desktop.
@import <Foundation/CPObject.j>
@import <AppKit/CPCib.j>
@implementation AppController : CPObject
{
CPWindow _window;
IBOutlet id myTextBox;
IBOutlet id myWindow;
IBOutlet id myButton;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var cib = [[CPCib alloc] initWithContentsOfURL:[[CPBundle mainBundle] pathForResource:@"MainMenu.cib"]];
[cib instantiateCibWithExternalNameTable:[CPDictionary dictionaryWithObject:self forKey:CPCibOwner]];
if([myTextBox isEditable])
[myTextBox setStringValue:@"yes"];
else
[myTextBox setStringValue:@"no"];
[myTextBox setTextColor:[CPColor blueColor]];
//This is what I was trying to accomplish!!!
[myWindow center];
[_window setFrameOrigin:CGPointMake(0.0, 0.0)];
[_window orderFront:self];
}
-(IBAction)myButtonAction:(id)sender {
alert("hello");
[myButton setTitle:@"Pressed"];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment