Re: Exception when clicking leftmost header in TableView
Re: Exception when clicking leftmost header in TableView
- Subject: Re: Exception when clicking leftmost header in TableView
- From: Nicola Vitacolonna <email@hidden>
- Date: Thu, 11 Apr 2002 17:25:43 +0200
>
Yes, you'll need to check to see if the clickedRow returns (-1). That
>
is NSTableView's way of saying that NO row was selected.
Ok, in my own method I check whether clickedRow returns -1 and I have
no problem (I report my code below just for reference). The exception is
raised *only* when clicking on the two or three leftmost pixels of the
leftmost header, and in that case my method is *not* called at all, as
isn't any other delegate I implemented (such as
shouldSelectTableColumn:). Instead, if I click in any other point of the
header, everything goes fine.
- (void)handleClickOnTableItem {
int column, row;
column = [theTable clickedColumn];
row = [theTable clickedRow];
if ([[[[theTable tableColumns] objectAtIndex:column] identifier]
isEqual:@"Leftmost Column"]) {
if (row > -1) { // If row == -1, the user clicked outside cells
[...]
}
}
}
>
I have another follow-up to the previous question that has a bit more
>
sample code in it for handling this. (Not that I'm saying it's the best
>
code, mind you. Aren't we ALL learning?).
>
>
Christopher
>
>
On Thursday, April 11, 2002, at 09:50 AM, Nicola Vitacolonna wrote:
>
>
> I have noticed the following strange behaviour in a TableView: when
>
> clicking near
>
> the left edge of the leftmost header, the following exception is
>
> raised,
>
> which I am not able
>
> to intercept and debug:
>
>
>
> 2002-04-11 16:36:13.878 MyApp[648] *** -[NSCFArray objectAtIndex:]:
>
> index (-1) beyond bounds (5)
>
>
>
> As suggested in a reply to my previous mail ("How to detect single
>
> mouse
>
> click in a TableView?")
>
> I setup
>
>
>
> [theTable setAction:@selector(handleClickOnTableItem:)];
>
>
>
> but my own handleClickOnTableItem is not called when I click over those
>
> two or three leftmost pixels. In every other case it is. (Actually, I
>
> noticed that it is not called when I click near the edges of every
>
> header, but only the leftmost raises the exception, while in the other
>
> cases nothing happens).
>
>
>
> Is it a bug or am I missing some check? Should I just ignore the
>
> exception?
>
>
>
> Regards,
>
> Nicola
>
>
>
> ** ** Get my PGP public key at:
>
> ** * ** * www.dimi.uniud.it/~vitacolo
>
> ** * ** * or finger email@hidden
>
> ** * Universita' degli Studi di Udine
>
> * ***icola Vitacolonna
>
>
>
> [demime 0.98b removed an attachment of type application/pgp-signature
>
> which had a name of PGP.sig; charset=US-ASCII]
>
> _______________________________________________
>
> 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.
>
>
** ** Get my PGP public key at:
** * ** * www.dimi.uniud.it/~vitacolo
** * ** * or finger email@hidden
** * Universita' degli Studi di Udine
* ***icola Vitacolonna
[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig; charset=US-ASCII]
_______________________________________________
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.