Re: NSTableView Drag & Drop... Well, Maybe
Re: NSTableView Drag & Drop... Well, Maybe
- Subject: Re: NSTableView Drag & Drop... Well, Maybe
- From: "mw" <email@hidden>
- Date: Thu, 10 Oct 2002 08:13:48 -0400 (EDT)
on 02-10-09 7:06 PM, mw at email@hidden wrote:
>
but now I keep getting
>
out-of-range errors when inserting objects into the main employees
array.
>
For example, this code:
>
>
while(index = [e nextObject]) {
>
[employees insertObject:[unarchivedPeople objectAtIndex:i]
>
atIndex:(unsigned)row];
>
i++;
>
row++;
>
}
>
>
Seems to SOMETIMES have a problem with the first line in the while
loop
>
It's too late at night for me to focus on this (my best work is done
>
when I
>
get up at 4:00 AM, unlike most programmers who go to bed then). But
>
it seems
>
to me that you can't insert an object and increment the loop counter
>
in the
>
same iteration without messing up the indices. In the next iteration,
>
the
>
index is referring to the object you just inserted.
I don't think that is the reason because it happens even when there
are just two objects in the table. If just one of them is being moved
(up, let's say), then that would mean deleting the object at index 1
first, (so the array now has one indice, 0), and then we insert the
object being moved into index 0. Supposedly, every other object is the
array is shifted down to make room for the new object. So we insert at
0, and the previous object at 0 is moved to index 1. There should be
no problem if insertObject:atIndex: is really shifting down like it is
supposed to.
mw
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.