Skip navigation.
 
mlRe: intercepting NSBrowser multiple selection extension with shift down/up arrow
FROM : Martin Redington
DATE : Tue Oct 14 14:11:29 2008

On Tue, Oct 14, 2008 at 8:12 AM, Andy Lee <<email_removed>> wrote:
> On Oct 14, 2008, at 12:45 AM, Martin Redington wrote:

>>
>> On Tue, Oct 14, 2008 at 5:25 AM, Andy Lee <<email_removed>> wrote:

>>>
>>> How about if you leave the matrix class alone and do [myBrowser
>>> setSendsActionOnArrowKeys:YES]?  Then give the browser a target and
>>> action,
>>> and in the action method do whatever you have to do.

>>
>> That sounds promising, although a bit disappointing and possibly still
>> a tiny bit hacky.

>
> It works for me.


Me too :-) with a couple of exceptions ... see below ...

> I did a quick test and it caught all the cases I tried,
> though I may have missed something.


I managed to remove all of my other notification posts, apart from

selectAll:

I also found that when modifying the selection programmatically, I
needed to post the notification manually, so a more general mechanism
than I require would need to post from at least a subset of the
selectXXX: methods.

> If it helps with the ick factor, I
> would say that it's much less hacky to take advantage of one method's
> documented purpose -- "do something when the selection changes, even if it's
> via keyboard" -- than to do trivial overrides of multiple methods that you
> select by trial and error.


Fair comment, although the documentation for setSendsActionOnArrowKeys
doesn't really state that explicitly - it probably wouldn't have
occurred to me to try that for a long time.

>> Surely it shouldn't really be that hard to capture/intercept selection
>> changes - to have to resort to trial and error over-riding of
>> selectXXX, et al. methods is a bit irksome.

>
> I agree, it seems a weird omission, given that with NSTableView you have a
> choice of using either a delegate method or a notification for that very
> purpose.
>
> --Andy
>




--
http://www.mildmanneredindustries.com/