Edit NSTokenField's token?

  • Mail allows the user to edit a token by double clicking it, or selecting
    edit from the token's menu.

    This behavior is not default for NSTokenField. Searching this mailing
    list and all mighty Google yields quite a few questions on this topic,
    but no answers unfortunately :(.

    Is there a way to let the user edit an existing token, instead of
    deleting and retyping?

    Tokens are highlighted when hovering the mouse (even when disabled,
    should this be a bug?), but I can not find a reference in the
    documentation for how to catch these events, or even selection of
    tokens. Browsing the NSTokenField and NSTokenFieldCell classes with the
    F-Script object browser do not reveal any obvious mehods for
    manipulating individual tokens. Am I missing something obvious, or does
    not Mail use NSTokenField at all?

    // Fredrik Olssn
  • On Jul 25, 2006, at 6:14 AM, Fredrik Olsson wrote:

    > Am I missing something obvious, or does not Mail use NSTokenField
    > at all?

    Mail doesn't use NSTokenField.

    Nick Zitzmann
    <http://www.chronosnet.com/>
  • 25 jul 2006 kl. 14.14.54 skrev Fredrik Olsson:

    > Mail allows the user to edit a token by double clicking it, or
    > selecting edit from the token's menu.
    >
    > This behavior is not default for NSTokenField. Searching this
    > mailing list and all mighty Google yields quite a few questions on
    > this topic, but no answers unfortunately :(.
    >
    > Is there a way to let the user edit an existing token, instead of
    > deleting and retyping?
    >
    > Tokens are highlighted when hovering the mouse (even when disabled,
    > should this be a bug?), but I can not find a reference in the
    > documentation for how to catch these events, or even selection of
    > tokens. Browsing the NSTokenField and NSTokenFieldCell classes with
    > the F-Script object browser do not reveal any obvious mehods for
    > manipulating individual tokens. Am I missing something obvious, or
    > does not Mail use NSTokenField at all?
    >
    >
    > // Fredrik Olssn

    I have also been looking for an answer to this question, but to no
    avail. I am currently writing an application where I need this menu to
    contain categories/properties for the tokens. When I click on the menu
    for a token, then the token is used as a key into a dictionary, to
    find the value, which contains the category/property to be changed.

    My problem is that I don't get the menu for the token to show up att
    all. In IB one can right-click on NSTokenFiled or NSTokenFieldCell and
    connect to a menu, but that doesn't work. I have also implemented
    tokenField:hasMenuForRepresentedObject: and
    tokenField:menuForRepresentedObject: in my code, and set that code to
    be the delegate for the NSTokenField or NSTokenFieldCell. I've tried
    both of them.

    Why is my menu not showing up?

    Best regards
    Daniel Strom
previous month july 2006 next month
MTWTFSS
          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
31            
Go to today