On Mon, Nov 14, 2011 at 6:18 AM, Motti Shneor <su...@bezeqint.net> wrote:
> However, if we need to PROGRAMMATICALLY set the selection, using 
> selectRowIndexes:byExtendingSelection: for example,  
> outlineView:shouldSelectItem: is never called.

>From "Selecting and Deselecting Rows Programmatically" in the Table
View Programming Guide:

> Note: It is important to note that when the row is changed programmatically 
> the selectionShouldChangeInTableView: message is not sent to the delegate. 
> This means that the application is responsible for ensuring the validity of 
> the contents of the currently selected row if it is being edited.

http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/TableView/RowSelection/RowSelection.html#//apple_ref/doc/uid/10000026i-CH6-SW6

The point is that you can make programmatic changes that the user
can't make with the mouse. The most common case is to disallow the
user from making any selection changes at all; only the program can
change the selection.

Just reuse whatever logic you've put into
-outlineView:shouldSelectItem:. If you want, factor out the validation
logic into its own method. If the conditions aren't met, either pass a
different set of row indexes to
-selectRowIndexes:byExtendingSelection: or just don't call that method
at all.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to