Re: Editing NSOutlineView Group Item
Re: Editing NSOutlineView Group Item
- Subject: Re: Editing NSOutlineView Group Item
- From: Luther Baker <email@hidden>
- Date: Tue, 04 Nov 2014 07:59:24 -0600
Here is the chain of calls -- although not ostensibly helpful. I have 2
items in my outline view - if I select, edit and then try to reload the
item at index=1.
///////
outlineView:isItemExpandable:
- item=selected item
- returns NO
outlineView:child:item
- item=nil, index=1
- returns the selected item
outlineView:isItemExpandable:
- item=selected item
- returns NO
///////
Done ... the outlineView cellView does not update. I also tried hard-coding
outlineView:isItemExpandable: to always return YES ... but reloading the
selected item then simply ran the very first delegate method and then
stopped.
///////
outlineView:isItemExpandable:
- item=selected item
- returns YES
///////
Thanks,
-Luther
On Tue, Nov 4, 2014 at 7:12 AM, Luther Baker <email@hidden> wrote:
> I was hoping these changes would do it ... but unfortunately, I'm still
> getting nothing ....
>
> You'll notice the logging below - I can confirm that the address of and
> object *selected* is the exact same address of and object I am *reloading*.
> Furthermore, the description logging from outlineViewSelectionDidChange:
> prints out the old text and the description logging from
> reloadSelectedIssue prints out the new text.
>
> Unfortunately, outlineView:viewForTableColumn: is never invoked.
>
> Thanks for the extended help Quincey,
> -Luther
>
>
> - (BOOL)outlineView:(NSOutlineView *)outlineView
> isItemExpandable:(id<PVOutlineViewItem>)item {
> return (item == nil);
> }
>
> - (void)outlineViewSelectionDidChange:(NSNotification *)notification {
> NSOutlineView *outlineView = notification.object;
> NSInteger selectedRow = outlineView.selectedRow;
> _selectedItem = [outlineView itemAtRow:selectedRow];
> NSLog(@"selected item:(%@)", self.selectedItem);
> }
>
> - (void)reloadSelectedIssue {
> NSLog(@"reload selected item: %@", _selectedItem);
> [_outlineView reloadItem:_selectedItem reloadChildren:YES];
> }
>
>
> On Mon, Nov 3, 2014 at 11:55 AM, Quincey Morris <
> email@hidden> wrote:
>
>> On Nov 3, 2014, at 04:12 , Luther Baker <email@hidden> wrote:
>>
>>
>> > Or perhaps you are mis-tracking the selected item.
>>
>> I've double checked what I thought I knew -- but as you imply, who knows
>> at this point.
>>
>>
>> You are mis-tracking the selected item, I think. The delegate method
>> ‘outlineView:shouldSelectItem:’ doesn’t tell you what *is* selected, nor
>> (necessarily) what *will be* selected. All it tells you is that
>> NSOutlineView has some reason for asking you whether it *could be* selected.
>>
>> A better delegate method to track what’s actually selected is
>> ‘outlineViewSelectionDidChange:’, and in that method you can ask the
>> outline view for the selection.
>>
>> I think your ‘outlineView:isItemExpandable:’ method is also wrong. You
>> should at least return YES when the item is nil.
>>
>>
>>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden