summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-23 11:25:33 -0400
committerPietro Gagliardi <[email protected]>2014-03-23 11:25:33 -0400
commitbcd4de443c89125a969f319eee8baf02e52905da (patch)
tree8a3bc2b9fd6705414f95161b3df4a930488e4f73
parent6ecf70bd3cc1e85658b3d961cd178e633a4bc571 (diff)
Added some Cocoa-related notes noticed when writing an input test.
-rw-r--r--areaplan.md10
1 files changed, 9 insertions, 1 deletions
diff --git a/areaplan.md b/areaplan.md
index 68bf544..f0bb502 100644
--- a/areaplan.md
+++ b/areaplan.md
@@ -314,6 +314,14 @@ func our_isFlipped(self C.id, sel C.SEL) C.BOOL {
For scrolling, we simply wrap our view in a `NSScrollView` just as we did with Listbox; Cocoa handles all the details for us.
+**IMPORTANT NOTE**: Before we move on to events, Cocoa requires that we override `acceptsFirstResponder` to return `YES` in order to accept events:
+```objective-c
+- (BOOL)acceptsFirstResponder
+{
+ return YES;
+}
+```
+
TODO erase clip rect?
## Mouse Events
@@ -615,7 +623,7 @@ Thankfully there IS a way to get keys that aren't printable characters! ...Mac O
(Technically you're supposed to send incoming key events to `[self interpretKeyEvents:]`, which will generate a bunch of text-related method calls to make things easier, but we don't have to. Technically you're also supposed to use key equivalents, but that doesn't apply here...)
-For modifier keys pressed by themselves, neither `keyDown:` nor `keyUp:` appears to be sent; we need to handle `flagsChanged:` (if I'm reading this right, anyway). Whatever the case, `[e modifierFlags]` will always be valid.
+For modifier keys pressed by themselves, neither `keyDown:` nor `keyUp:` appears to be sent; we need to handle `flagsChanged:` (if I'm reading this right, anyway). Whatever the case, `[e modifierFlags]` will always be valid. In `flagsChanged:`, `characters` will **NOT** be valid and **WILL** throw an exception.
There's also `[e isARepeat]`, which tells us whether a key was repeated; it does not say how many times. (*TODO* does this mean `keyDown:` is sent multiple times?)