Programatically Editing and NSTokenFieldCell (Inside an NSTextView)
Programatically Editing and NSTokenFieldCell (Inside an NSTextView)
- Subject: Programatically Editing and NSTokenFieldCell (Inside an NSTextView)
- From: email@hidden
- Date: Fri, 9 Nov 2007 00:44:58 +0900
Hi,
I have an NSTextField that contains a custom cell that represents
attachments.
It has fulfilled the delegate method requirements for
<NSTextAttachmentCell>, so now I am trying to get editing of its text
to work.
I looked for some entry point to start editing and decided to use the
method:
- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:
(NSView *)controlView atCharacterIndex:(NSUInteger)charIndex
untilMouseUp:(BOOL)flag;
In that method, the cell calls editWithFrame: to self like so:
- (BOOL)wantsToTrackMouseForEvent:(NSEvent *)theEvent inRect:
(NSRect)cellFrame ofView:(NSView *)controlView atCharacterIndex:
(NSUInteger)charIndex {
//This is just a quick test to get text editing working
[self editWithFrame:cellFrame inView:controlView editor:[[controlView
window] fieldEditor:YES forObject:nil] delegate:[(NSTextView
*)controlView delegate] event:theEvent];
return YES;
}
The problem is, the NSTokenFieldCell doesn't get edited.... e.g the
field editor does not appear over the token field.
Additonally, I'm not sure where to call endEditing because if I click
outside of the cell while its being edited.... the containing
NSTextField doesn't know about the other editing that is going on...
so there is no real place to call [self endEditing:]
Any pointers??
I've read the NSCell programming topics and searched forums but turned
up nothing......
Andre
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden