NSCollectionView OSX Cocoa Multiple Selection

I recently reviewed one of my applications, which I released a year ago. And I see that currently NSCollectionViewinside it has lost the work of choice, for example SHIFT + Select, now it behaves like CMD + Select, and also I can not select several cells with the mouse (the mouse does not even draw a selection rectangle).

Obviously, I want to return these functions.

What I've done:

//NSCollectionView * _picturesGridView; //is my iVar

//In initialization I have set my _picturesGridView as follows
//Initializations etc are omitted -- (only the selection related code is here)
[_picturesGridView setSelectable:YES];
[_picturesGridView setAllowsMultipleSelection:YES];

Question: Is there an easy way to return this functionality? I do not see anything related to the documentation, and I could not find any solution on the Internet.

Sub Question: If there is no easy way to achieve this → Should I continue and create my own FancyPrefix##CollectionViewClassand redefine this function NSCollectionViewas I wish - or is it better to go over the existing one and make it behave the way I want?

Note: Well, if I find that I am redefining it, it will be an easy class that will fit my own needs. I mean, I will not imitate the whole class NSCollectionView.

PS I can select an item by clicking on it. I can select multiple items with just CMD + Click or SHIFT + Click, but the latter behaves exactly like CMD + Click, which I don't want either.

Selection Rectangle - - . , : - |

+4

Source: https://habr.com/ru/post/1628333/


All Articles