Re: I can't figure out how to use NSIndexSet
Re: I can't figure out how to use NSIndexSet
- Subject: Re: I can't figure out how to use NSIndexSet
- From: Scott Anguish <email@hidden>
- Date: Thu, 20 Nov 2003 16:37:32 -0500
Here is the 'soon to be in the doc' code for iterating forwards and
backwards through an indexset
unsigned currentIndex = [theIndexSet firstIndex];
while (currentIndex = != NSNotFound) {
...
currentIndex = [theIndexSet indexGreaterThanIndex: currentIndex];
}
unsigned currentIndex = [theIndexSet lastIndex];
while (currentIndex = != NSNotFound) {
...
currentIndex = [theIndexSet indexLessThanIndex: currentIndex];
}
If you have specific comments on the IndexSet docs, please either file
them as a bug, or send them to me.
The doc is for you folks, so we'd like to hear what you need. (bugs is
the official way...)
On Nov 20, 2003, at 9:02 AM, John Clayton wrote:
That sums it up pretty much. Once I have it, how the heck can I
iterate through it? If I try this:
int *buf;
NSRange myRange
int indCount = [myIndexSet getIndexes:buf maxCount:200
inIndexRange:&myRange];
I always get a return value of 0 and a range with location NSNotFound
(I think, 18...n).
If I print out the index set, NSLog(@"index set is %@",myIndexSet),
everything looks fine-it shows the selections in my outline view just
perfectly.
I am not the best C programmer, have I made an error with my pointers
or something? Can anyone provide an example of using an index set top
get a handle on some outline view or table view items? And, does
anyone else have trouble understanding the documentation on NSIndexSet?
Thanks a lot.
Regards,
John Clayton
--------------------------
Software Developer
Online Channel Development
email@hidden
Regards,
John Clayton
--------------------------
Software Developer
Online Channel Development
email@hidden
201.748.5717
_______________________________________________
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.
_______________________________________________
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.