Contribute  :  Calendar  :  Advanced Search  :  Site Statistics  :  Directory  :  Files to download  :  Links for developers  :  Privacy policy  :  Web Resources  :  Polls  
    MacOSX Guru Site Information, tips and tricks, FAQ for Mac OS X developers    
 Welcome to MacOSX Guru Site
 Sunday, March 24 2019 @ 10:06 AM UTC

Tracking NSBrowser selection

Cocoa Development FAQBefore 10.6, it was not easy to do, subclassing the browser cell was one way to do it, but since 10.6 it's easier, here is how to…

Introduced in 10.6:

- (NSIndexSet *)browser:(NSBrowser *)browser selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes inColumn:(NSInteger)column
By implementing this method in your delegate/datasource, you can test if the selection will be empty after the processing of the proposed index will be done:

BOOL willGoNoSelection = (column == 0) && ([proposedSelectionIndexes count] == 0) ;
and then, according to your needs, turn on/off UI items. The initial state of these items remain to be set up in some "init" method: only you know if the selection is empty at start of the browsing session or not.

What's Related

Story Options

Tracking NSBrowser selection | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
 Copyright © 2019 MacOSX Guru Site
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.07 seconds