Re: Edit NSTokenField's token?
Re: Edit NSTokenField's token?
- Subject: Re: Edit NSTokenField's token?
- From: Alexander Griekspoor <email@hidden>
- Date: Fri, 7 Dec 2007 09:09:09 +0000
Hi,
Unfortunately the double-click editing of tokens is not possible on
Tiger. I ended up with a menu with an edit item that tries to bring
it back in editing mode again (tricky). Good news is that double-
click editing is there in Leopard now, however be aware that for some
(compatibility) reason you has to build against the 10.5 SDK to get
this behaviour. If you do the tokenfield still won't have double-
click editing on Tiger, but it does on Leopard.
Regarding the menus, I don't think linking to a menu in IB will work,
you can great an IBOutlet from your class to get a variable in your
code pointing to the menu in your nib, and then return that in
tokenField:hasMenuForRepresentedObject:
Hope that helps,
Alex
FROM : Daniel Ström
DATE : Fri Dec 07 08:35:38 2007
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
_______________________________________________
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