On Oct 05, 2009, at 19:44, Mario Kušnjer wrote:

Hello to the list !

Request for help regarding a little problem.
So I have this piece of code:

- (IBAction)addNewItem:(id)sender
{
        if ([lsOutlineView selectedRow] < 0)
        {
                [sourceListLevelZero addObject:[Parent new]];
                [lsOutlineView reloadItem:nil reloadChildren:YES];
                [lsOutlineView expandItem:nil expandChildren:YES];

Can't comment on this part as I am not exactly sure what you are doing. However note that in the first line of the block above you are most probably retaining an object twice. This is not a leak if you insist on garbage collection, but otherwise it is.

[lsOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex: [lsOutlineView rowForItem:[Parent new]]] byExtendingSelection:NO];

Well, assuming that you wanted to select the Parent item you added to the sourceListLevelZero, you should query the outline for the row index of *that* item, and not of a new Parent. Besides that to me the line makes sense...

HTH,
F

        }
        ...
}

It is the last line that trouble's me.
It should select newly added item in the list (right ?), but it does not !
Or am I doing something wrong (very likely !) ?

Ok, so you got it by now that I am trying to get the behavior that when user clicks add button new item that appears in the list automatically gets selected.

Thanks for help
Bye

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to