Re: NSTokenField thoughts... please help.
Re: NSTokenField thoughts... please help.
- Subject: Re: NSTokenField thoughts... please help.
- From: Gustavo Pizano <email@hidden>
- Date: Tue, 11 May 2010 11:15:05 +0200
HAHAHa it was simpler than I thought. !
I just need to place another NSTokenField wit all the tokens strings coma-separated and then APi allows me to Drag and Drop from one to another..!!!!
Why I didn't try that before?
Gustavo.
On May 11, 2010, at 10:39 AM, Gustavo Pizano wrote:
> Hello all, once again.
>
> Im trying to reproduce something similar to the name formatting of Aperture when importing images. So the idea is to allow the user to to set a format by dragging "tokens" into a NSTokenField, to later apply the format into when required.
>
> So these are my theories on how to approach the beast:
>
> 1. Create a Custom Object which has ivars, NSImage image, and a NSString for the formatValue, so i.e I can have an object with a format value @"YYYY", and the image an image with shows Year Number. and so on for month, day and counter.
>
> 2. Set the images in the view bellow the NSTokenField.
>
> 3. Implement D-n-D, for these I guessI will have to subclass NSTokenField to be able to implement there the necessarily dropping methods.
>
> 3. When dropping read the pasteboard and get the CustomObject's formatValue string and somehow append that string to what the NSTokenField (self in this case) has.
>
> 4. In the NSTokenField delegate implement: tokenField:representedObjectForEditingString:, tokenField:representedObjectForEditingString:, so I can display the string in the encapsulated style, (the blue rounded background).
>
> I have some doubts in 3 and 4, in 3 because I saw in the NSTokenFieldCellDelegate a method called:
>
> • – tokenFieldCell:readFromPasteboard:
> • – tokenFieldCell:writeRepresentedObjects:to
> So I dunno how this may help me for the Drag and Drop.
>
>
> and on 4th, because I dunno if the first delegate method will ever be called due that Im not typing directly but appending something in the TextField.
>
>
> Anything else I shall have in mind to fully implement this req. ?
>
>
> Thanks in advance
>
> Gustavo
>
_______________________________________________
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