Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > -(void)setDoubleAction: (sel)aSelector ?

-(void)setDoubleAction: (sel)aSelector ?
Thread Tools
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Mar 28, 2002, 06:13 PM
 
I am trying to implement a method that responds to a double-click on an uneditable row in an NSTableView. I have set up the target action method and I think I just have to tell the tableView which method to use. I believe -(void)setDoubleAction sel)aSelector is the way to go, but I can't figure out how to pass in the name of the method. I tried:

[myTableView setDoubleAction:myTargetMethod];

where myTargetMethod is just the name of the method:

-(IBAction)myTargetMethod id)sender

This gives me a type mismatch. Can anyone tell me how to do this?

thanks,
kman
     
Fresh-Faced Recruit
Join Date: Jan 2000
Location: Los Altos, CA, USA
Status: Offline
Reply With Quote
Mar 28, 2002, 07:02 PM
 
the syntax for passing a selector is:

@selector(yourselectorname:)

so I think it should be, in your case,

[myTableView setDoubleAction:@selector(myTargetMethod : )];


Another option would be to subclass a table view, and let the datasource take care of the double clicking e.g.

// MyListTableView.h
#import <Cocoa/Cocoa.h>
@interface MyListTableView : NSTableView {
}
- (void) mouseDown: (NSEvent *) theEvent;
@end

---

// MyListTableView.m
#import "MyListTableView.h"
@implementation MyListTableView
- (void) mouseDown: (NSEvent *) theEvent{
id theDataSource;
if ([theEvent clickCount]==2) {
theDataSource = [self dataSource];
[theDataSource myListTableViewDoubleClicked: self];
}
[super mouseDown:theEvent];
}
@end

(edited to remove smiley faces)

[ 03-28-2002: Message edited by: Brad Brack ]

[ 03-28-2002: Message edited by: Brad Brack ]
     
kman42  (op)
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status: Offline
Reply With Quote
Mar 28, 2002, 07:29 PM
 
Thanks. Actually, my cells aren't as uneditable as I thought. How do I go about setting them as uneditable?

kman
     
Fresh-Faced Recruit
Join Date: Jan 2000
Location: Los Altos, CA, USA
Status: Offline
Reply With Quote
Mar 28, 2002, 10:00 PM
 
To make a column, er, more non-editable, double click on the column header in Interface Builder, then go to the 'Attributes' tab in the info window, and uncheck 'Editable'. You'll need to do so for each of your columns.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:27 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2