Hi Everyone.

Hi everyone. We have a source-detail window, in which the source-view uses an 
NSOutlineView. We implement it  in a rather simplistic way because we only have 
two levels, one of which is constant (constant sections) and several items in 
each section. We don't use bindings, or an NSTreeController, but rather 
implement few delegate and data-source protocol methods. Namely:

- (id)outlineView:child:ofItem:
- (BOOL)outlineView:isItemExpandable:
- (NSInteger)outlineView:numberOfChildrenOfItem:
- (id)outlineView:objectValueForTableColumn:byItem:

- (BOOL)outlineView:isGroupItem:
- (BOOL)outlineView:shouldSelectItem:

Our problem is this:

Whenever a user clicks on an item,  outlineView:shouldSelectItem:  gets called 
for the item, and the item can try to show its detail view --- and return YES, 
or --- if it failed to show its detail, return NO and so prevent the selection.

However, if we need to PROGRAMMATICALLY set the selection, using 
selectRowIndexes:byExtendingSelection: for example,  
outlineView:shouldSelectItem: is never called. 

We tried to work with the NSOutLineView notifications

- (void)outlineViewSelectionDidChange:(NSNotification *)notification;
- (void)outlineViewSelectionIsChanging:(NSNotification *)notification;

Becasue the header file says:

/* Note for the following NSOutlineViewItem*Notifications:
   The 'userInfo' dictionary in the notification will have an @"NSObject" key 
where the value is the changed (id)item.
*/

but despite this documentation the userInfo dictionary was EMPTY in both 
notifications, and anyway --- non of them was actually called BEFORE selection 
was done.

We currently work around this by imitating the whole process (first changing 
the detail, and only if it succeeds, go on and change the selection in the 
OutlineView) but this is double implementation, and way too ugly to be a Cocoa 
program.

Hints anyone?




Motti Shneor, 
Senior Software Engineer and Team Leader,  Spectrum Reflections LTD.
Office eMail: mo...@spetrum-reflections.com
---
ceterum censeo microsoftiem delendam esse
---











_______________________________________________

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