Hello List:My Sudoku Puzzle game needs to get keyboard digits, 1 thru 9, and
the arrow keys as input.I have read Handling Key Events in the Cocoa Event
Handling Guide and produced this codewhich compiles ok and runs giving me
system beeps indication that my keyDown function is not working as I expected.
I searched the Archives also.import Cocoa
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.nextResponder = super.nextResponder //insert self into the
Responder chain
}
override var representedObject: AnyObject? {
didSet {
}
}
override var acceptsFirstResponder: Bool {
return true
}
override func keyDown(theEvent: NSEvent) {
println("key down is \(theEvent.description)") //system console should
be displaying the keypress
}
override func becomeFirstResponder() -> Bool {
return true
}
override func resignFirstResponder() -> Bool {
return true
}
}//--------- Thomas ------
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]