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: Matt Neuburg <email@hidden>
- Date: Fri, 03 Mar 2006 13:29:58 -0800
- Thread-topic: I can't figure out how to use NSIndexSet
So, to revive a (very) old thread, did this 'soon to be in the doc' code
ever actually make it into the docs? I can't find it. And NSIndexSet is
curiously linked in the docs to Collections, a set of conceptual docs that
never mention NSIndexSet at all. It seems to me there's a rather significant
hole in the docs at this point. m.
On Thu, 20 Nov 2003 16:37:32 -0500, Scott Anguish <email@hidden>
said:
>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?
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden