Re: Custom NSTextView used as field editor doesn't support spoken keystrokes by VoiceOver
Re: Custom NSTextView used as field editor doesn't support spoken keystrokes by VoiceOver
- Subject: Re: Custom NSTextView used as field editor doesn't support spoken keystrokes by VoiceOver
- From: James Dempsey <email@hidden>
- Date: Thu, 8 Nov 2007 11:28:51 -0800
Daniel,
You should be able to catch all of those NSResponder control points
with an NSTextView delegate instead of a subclass. When the field
editor is used by an NSTextField, the NSTextField is automatically set
as the delegate of the field editor.
So if you put the custom behavior in a subclass of NSTextField that
implements the delegate methods, you will get your custom behavior,
plus it should work with VoiceOver.
In general it is best to take delegation as far as you can with an
NSTextView (and that is typically pretty far) before subclassing it.
http://developer.apple.com/documentation/Cocoa/Conceptual/TextEditing/index.html
The section "Intercepting Key Events" describes using the delegate in
this fashion.
The section "Working with the Field Editor" talks about delegation and
notification.
I've already filed a bug about this, so no need.
-James
On Nov 8, 2007, at 10:01 AM, Daniel Schwill wrote:
Hello James,
On 07.11.2007, at 23:43, James Dempsey wrote:
Daniel,
A few questions:
1. Is this NSTextView subclass being used in a cell in a table view
or outline view?
I use this NSTextView as the field editor for two NSTextFields as
well as directly as a text view (subview) in a plain view. It works
perfect directly used in the view, but doesn't work used in the
NSTextFields.
2. Could you run your app with the argument -
NSAccessibilityDebugLogLevel 1 and see if there are any errors
logged when you edit the field with VoiceOver running? Any output
would be helpful.
I ran the app with the argument -NSAccessibilityDebugLogLevel 1, but
there were no errors logged when I edited the field with VoiceOver
running.
3. What is the basic gist of the changes you've made to the
NSTextView? It may be you've overridden something that normally
sends an AX notification.
I've overridden some methods from NSResponder like insertText:,
moveUp:/-Down:/-Left:/-Right:, insertTab:/-Backtab: or paste: for
example to archive a special behavior of the field editor.
As mentioned above my custom NSTextView works fine with VoiceOver
when it is used directly as a text view in a plain view, but doesn't
work when it is used as a field editor for a text field.
Are there any additional steps needed when I create and use a custom
NSTextView as a field editor for a text field?
I'm currently using - (NSText *)fieldEditor:(BOOL)createFlag
forObject:(id)anObject of NSWindow to create and return my custom
NSTextView.
The code looks like this:
- (NSText *)fieldEditor:(BOOL)createFlag forObject:(id)anObject
{
if ([anObject isKindOfClass:[NCTextField class]])
{
if (textFieldEditor == nil && createFlag)
{
NCTextFieldEditor *newTextFieldEditor = [[NCTextFieldEditor
alloc] initWithFrame:NSZeroRect];
[newTextFieldEditor setRichText:YES];
[self setTextFieldEditor:newTextFieldEditor];
[newTextFieldEditor release];
}
return textFieldEditor;
}
return [super fieldEditor:createFlag forObject:anObject];
}
Regards,
Daniel
On Nov 6, 2007, at 2:08 AM, Daniel Schwill wrote:
Hi,
I'm using a custom NSTextView as the field editor for two fields
in my app, but VoiceOver doesn't speak the keystrokes when editing
these fields.
Any hints why this doesn't work with my custom NSTextView?
Is something missing in my custom NSTextView to support spoken
keystrokes by VoiceOver?
--------------------------------------------------
James Dempsey
AppKit Engineering
Apple
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden