Re: Selector runs only once
Re: Selector runs only once
- Subject: Re: Selector runs only once
- From: Phill Kelley <email@hidden>
- Date: Wed, 03 Sep 2003 11:48:59 +1000
At 23:50 +0200 02/09/2003, Sanri Parov wrote:
>
Hi everybody,
>
>
I've got to deal with a simple table view in a class and I'd like it to
>
do something when I double click the mouse on it. I thought adding this:
>
>
- (void)awakeFromNib
>
{
>
[table_gui setTarget:self];
>
[table_gui setDoubleAction:@selector(mySelector)];
>
}
>
>
but the selector "mySelector" works only if I doubleclick on 'table'
>
just after the app starts, not if I do something else with the class
>
which controls 'table'.
>
I'd like it to run for the entire duration of my application.
>
What am I doing wrong?
I'm not 100% sure but I think the reason might have something to do with
the way you've set up the action message. I'm reasonably certain that the
action message needs to have the same signature as any IBAction:
- (void) mySelector:(id)sender
{
NSLog(@"I was double-clicked");
}
and that would mean that your statement above should be:
[table_gui setDoubleAction:@selector(mySelector:)];
Note the colon after mySelector.
That approach works for me (assuming, of course, that table_gui references
an NSTableView or subclass thereof *and* that table_gui has been wired-up
correctly in IB).
Regards, PK
_______________________________________________
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.