[MlMt] Mailing lists and Mailmate
Benny Kjær Nielsen
mailinglist at freron.com
Thu Jan 26 07:49:12 UTC 2012
On 26 Jan 2012, at 0:27, Seebs wrote:
> On 25 Jan 2012, at 17:23, Benny Kjær Nielsen wrote:
>
>> I agree. I use Apples NSTokenField class for the address fields and
>> so far I have been unable to track drag'n'drop actions such that I
>> could remove an address from a source NSTokenField. If anyone has any
>> code which does something like that (for NSTokenFields) then please
>> let me know. I've forgotten the ugly details, but (to me) it was a
>> non-trivial problem. (The workaround is of course to use cut and copy
>> instead.)
>
> Well, it must be possible, 'cuz I think Apple Mail does it.
I almost decided to give an answer to that argument in my first reply
:-) First, anything is possible and I did not claim that it was not
possible to do it. I claimed it was non-trivial. It may be trivial to
Apple, because they can access private APIs or they can make their own
variant of NSTokenField for Apple Mail based on the source code. I have
to either re-implement NSTokenField or find some way to make it do what
I want using the public API (if I use private API then I risk that it is
not going to work in future updates of Mac OS X and I'm definitely out
of the App Store). So, my claim is that it is non-trivial to make
NSTokenField do what I want under the restrictions imposed by the public
API (and any bugs in NSTokenField). Now, I may be wrong and that is why
I asked for example code if anyone knew this to be the case.
> Cheap workaround: If a token is dragged into a field, and you notice
> that the token occurs only in one other field, of the same basic type,
> you can just remove it from that field and be right 99% of the time.
> Do this only if option wasn't down for the drag and it'll look like
> you're moving-or-copying the way people expect that to work, I think?
Now that may not be a bad idea, but the problem with NSTokenField is
that it is difficult to monitor drag events. As I wrote previously I
forgot the ugly details, but as I recall I concluded that the only way
forward was probably to subclass the so-called field editor (for those
who know Cocoa) and that was when I decided that it wasn't currently
worth the effort.
> More generally, you could have a preference with a name like "only
> allow a given address once in recipient fields". At that point,
> adding an address to a field implicity removes it from all others. In
> practice we probably want that anyway.
Good point. This also gives me an idea for a workaround in which I don't
directly monitor dragging events, but instead monitor paste events and
token insertions to implicitly monitor dragging events. It would not be
perfect, but maybe it would be good enough.
--
Benny
More information about the mailmate
mailing list