Programatically Editing and NSTokenFieldCell (Inside an NSTextView)

  • Hi,

    I have an NSTextField that contains a custom cell that represents
    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

    - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:
    (NSView *)controlView atCharacterIndex:(NSUInteger)charIndex

    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......

previous month november 2007 next month
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today