Skip to content

Instantly share code, notes, and snippets.

@EternityGerwin
Last active May 2, 2016 08:48
Show Gist options
  • Save EternityGerwin/c9b763eb1c915042b9489131235d4852 to your computer and use it in GitHub Desktop.
Save EternityGerwin/c9b763eb1c915042b9489131235d4852 to your computer and use it in GitHub Desktop.
var win : NSWindow? = nil;
class ViewController: NSViewController{
//..
override func KeyDown(theEvent:NSEVENT){
f.KeyDown(theEvent);
if let keyString = theEvent.charactersIgnoringModifiers where keyString == "u" || keyString == "U"{
if(win == nil){
win = NSWindow(contentRect : NSMakeRect(100, 100, 600, 200).
- styleMask: NSResizeAbleWindowMask,
- backing:NSBackingStoreType.Buffered, defer: false);
self.view.window?.addChildWindow(win, ordered: .Above);
win.makeKeyAndOrderFront(theEvent);
}
else{
win.close();
se;f.view.window?.removeChildWindow(win!);
win = nil;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment