Re: Signed incoherences with NSTableView indexes
Re: Signed incoherences with NSTableView indexes
- Subject: Re: Signed incoherences with NSTableView indexes
- From: "R. Matthew Emerson" <email@hidden>
- Date: Tue, 17 Oct 2006 10:11:29 -0400
On Oct 17, 2006, at 6:56 AM, Stephane wrote:
It looks like that there are some incoherences in the way
NSTableView deals with selection (from a signed/unsigned point of
view).
If you need to find the currently selected row, the recommended API
is:
- (int) selectedRow;
If you need to find the currently selected rows, the recommended
API is:
- (NSIndexSet *) selectedRowIndexes;
Considering that a NSIndexSet only deals with "unsigned
int" (according to the header and documentation), this results in a
strange situation where an index is either an int or an unsigned int.
Wouldn't it be possible to only use "unsigned int" in the API
definitions?
You would, of course, need some other way for selectedRow to indicate
that there is no row selected if it returned an unsigned int.
(selectedRow returns -1 if no row is selected).
unsigned index;
int r = [tv selectedRow];
if (r != -1)
index = (unsigned)r;
Not exactly beautiful, I agree, but I guess we've got art and museums
and stuff for that. :-/
(please note ironic smiley)
_______________________________________________
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