What NSEvent contains text from Ink input?
What NSEvent contains text from Ink input?
- Subject: What NSEvent contains text from Ink input?
- From: Ricky Sharp <email@hidden>
- Date: Sat, 19 Nov 2005 11:26:49 -0600
In the Carbon flavor of my app, I allowed for Ink input (both
gestures and text). This was a simple matter of either handling the
kEventTextInputUnicodeForKeyEvent carbon event, or raw keydowns.
When doing keydowns, you'd get a stream of individual keydown
events. So if I wrote ABC, I'd get three keydown events.
The purpose of this was to allow my users to write answers to
flashcards presented on the screen. There are no traditional text
fields to contain the user's answer. They just write anywhere and
whatever they wrote is captured as their answer and the next
flashcard is shown.
In Cocoa, I'm finding that my keyDown: methods are only being called
with Ink gestures (e.g. horizontal line drawn right to left to
simulate pressing the delete key).
I've verified that Ink is set up appropriately as I do this at app
startup:
InkSetApplicationWritingMode (kInkWriteAnywhereInApp);
InkSetApplicationRecognitionMode (kInkRecognitionGesture |
kInkRecognitionText);
If I implement tabletPoint: in my window/view it is always called.
But alas, you cannot sent it the characters message as that's only
for keyboard events.
Now then, my app uses custom views/controls. In one specific case, I
do use an NSTextField. That control receives handwritten text a-ok
(whatever I write is inserted at the insertion point). This leads me
to believe that perhaps I need to implement some method in my custom
views.
I don't need to implement shouldBeTreatedAsInkEvent: in any of my
classes, because NSViews return YES by default and NSControls return
NO. Thus allowing write-anywhere in views, but the ability to track
controls via the pen. This is exactly what my app does; I can write
anywhere in views that are not controls.
I've also read the "Implementing Text Management Support" at:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
InputManager/index.html>
Do I need to have my views implement the NSTextInput protocol? That
seems like an awful lot of baggage. I would have assumed that I'd
get either a series of keydowns or a single keydown (that would
contain all characters written).
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden