Re: Custom Field Editors
Re: Custom Field Editors
- Subject: Re: Custom Field Editors
- From: j o a r <email@hidden>
- Date: Mon, 2 Aug 2004 19:54:05 +0200
I don't *know* what's wrong, but here are a couple of thoughts:
* You're not using the designated initializer for the text view. Bad
boy!
* Although the documentation for "setUpFieldEditorAttributes:" states
that it can be used for replacing the field editor, I've never done it
that way - and it's not mentioned here:
<
http://developer.apple.com/documentation/Cocoa/Conceptual/WinPanel/
Tasks/UsingWindowFieldEditor.html>
You might want to consider using the method in the window delegate
instead (if compatible with your design).
* Check to see what field editor is returned when you call "[super
setUpFieldEditorAttributes: fieldEditor]". Is it the one you expect
(ie. your custom shared instance)?
What is the backtrace of the crash?
j o a r
On 2004-08-02, at 19.13, Andrew wrote:
>
I am trying to use a custom field editor for my cell but am having
>
difficulties. I've tried to make a simple app to isolate the problem.
>
>
I have one window with an NSTableView in it with one column. The cells
>
it uses are of the type MyTextFieldCell which inherits from
>
NSTextFieldCell. MyTextFieldCell has a class method fieldEditor...
>
>
+ (NSTextView *)fieldEditor {
>
static NSTextView *secretFieldEditor = NULL;
>
>
if (secretFieldEditor == NULL) {
>
secretFieldEditor = [[NSTextView alloc] init];
>
[secretFieldEditor setFieldEditor: YES];
>
[secretFieldEditor setUsesFontPanel: NO];
>
[secretFieldEditor setUsesRuler: NO];
>
[secretFieldEditor setUsesFindPanel: NO];
>
}
>
>
return secretFieldEditor;
>
}
>
>
Then I have overridden setUpFieldEditorAttributes...
>
>
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj {
>
NSText *fieldEditor;
>
>
fieldEditor = [MyTextFieldCell fieldEditor];
>
>
fieldEditor = [super setUpFieldEditorAttributes: fieldEditor];
>
// do I need to do this?
>
[fieldEditor setDelegate: self];
>
>
return fieldEditor;
>
}
>
>
When I run my test app and try to edit the contents of a cell the
>
field editor appears (though it doesn't look quite right - more like a
>
white rectangle - can't quite say what's wrong with its appearance).
>
When I type into the editor however no text appears. None of my
>
delegate functions get called. Randomly the app dies with sig 10.
>
>
Would someone give me a few hints? I've read all the docs I can find
>
but perhaps I'm missing the obvious...
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.