Hi Kevin, (cc'ing the list, in case others have the same question).

On Jan 12, 2011, at 12:55 PM, Kevin Meaney wrote:

> Thanks Corbin,
> 
> Will modifying the current selection of the outline view in the delegate 
> method outlineView:selectionIndexesForProposedSelection cause any problems as 
> well as modifying the indexes in the proposed selection.

You should probably not modify the selection on the outlineView in that method, 
since it is going to set the selection to what was returned.

corbin


> 

> On Jan 12, 2011, at 10:45 AM, Kevin Meaney wrote: 
> 
> Hi, 
> 
> In my outline view I need to allow multiple selection, but only allow all 
> selected items to have the same parent. In other words as soon as the user 
> selects an item with a different parent to the currently selected items even 
> if they are in add to selection mode, the previously selected items get 
> deselected. 
> 
> The NSOutlineView documentation does not seem to be complete on the relevant 
> methods. According to the NSTableView documentation if the delegate method: 
> tableView:selectionIndexesForProposedSelection is implemented then 
> selectRow:byExtendingSelection will not be called and the documentation for 
> both is available. But for NSOutlineView there doesn't appear any 
> documentation for the delegate method outlineView:shouldSelectItem and the 
> information in the header file only says that for performance reasons it is 
> better to use outlineView:selectionIndexesForProposedSelection: 
> 
> But there is not enough information like for the table view documentation as 
> to whether either of methods are mutually exclusive or not, 
> 
> 
> Hi Kevin, 
> The header says: 
> 
> 
> /* Optional - Return a set of new indexes to select when the user changes the 
> selection with the keyboard or mouse. If implemented, this method will be 
> called instead of outlineView:shouldSelectItem:. This method may be called 
> multiple times with one new index added to the existing selection to find out 
> if a particular index can be selected when the user is extending the 
> selection with the keyboard or mouse. Note that 'proposedSelectionIndexes' 
> will contain the entire newly suggested selection, and you can return the 
> exsiting selection to avoid changing the selection. 
> */ 
> - (NSIndexSet *)outlineView:(NSOutlineView *)outlineView 
> selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes 
> 
> 
> In particular: 
> 
> 
> "If implemented, this method will be called instead of 
> outlineView:shouldSelectItem:. " 
> 
> 
> Thus, they are mutually exclusive. If there is any way we can make it 
> clearer, please let me know. 
> 
> 
> 
> 
> You want to use that delegate method to control selection. You can use 
> itemAtRow to find the items and restrict them as you require. 
> 
> 
> corbin 
> 
> 

_______________________________________________

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