Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Created September 5, 2011 03:37
Show Gist options
  • Select an option

  • Save TooTallNate/1194032 to your computer and use it in GitHub Desktop.

Select an option

Save TooTallNate/1194032 to your computer and use it in GitHub Desktop.
Creating a Cocoa GUI window with NodObjC
var $ = require('./')
$.import('Foundation')
$.import('Cocoa')
var pool = $.NSAutoreleasePool('alloc')('init')
var app = $.NSApplication('sharedApplication')
var style = $.NSClosableWindowMask | $.NSResizableWindowMask
| $.NSTexturedBackgroundWindowMask | $.NSTitledWindowMask
| $.NSMiniaturizableWindowMask
var rect = $.NSMakeRect(50, 50, 600, 400)
var win = $.NSWindow('alloc')('initWithContentRect', rect
, 'styleMask', style
, 'backing', $.NSBackingStoreBuffered
, 'defer', 0)
win('makeKeyAndOrderFront', win)
app('run')
pool('release')
@billymoon

billymoon commented Sep 15, 2011 via email

Copy link
Copy Markdown

@TooTallNate

Copy link
Copy Markdown
Author

Oh I see what's going on. You're on NodObjC@0.0.3. That version doesn't have a lot of the good stuff. I just published v0.0.7 which gives support back for node 0.4.x. So re-run npm install NodObjC and let me know how it goes.

@billymoon

billymoon commented Sep 15, 2011 via email

Copy link
Copy Markdown

@TooTallNate

Copy link
Copy Markdown
Author

@billymoon Come to IRC room #nodobjc on Freenode and I can help walk you through it.

@billymoon

billymoon commented Sep 15, 2011 via email

Copy link
Copy Markdown

@TooTallNate

TooTallNate commented Sep 15, 2011 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment