Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

canavid

macrumors newbie
Original poster
Mar 18, 2014
1
0
Im just new for programing for OSX I wonder to know how I can double click or click on a label then I can send a command? here is my h file

Code:
- (IBAction)lbl1:(id)sender;
and my m file is here

Code:
- (IBAction)lbl1:(id)sender {
    [[NSPasteboard generalPasteboard] clearContents];
    [[NSPasteboard generalPasteboard] setString:_lbl1.stringValue forType:NSStringPboardType];
}
when i double click or click on the label nothing happens and it will not copy the string of the label to pastboard thanks
 
Last edited by a moderator:
add an function like this:
Code:
- (void)mouseDown:(NSEvent *)event {
    doubleClicked = No;
    if (event.clickCount == 2)
        doubleClicked = YES;
}

check in your IBAction if the BOOL doubleClicked is true. then do your clipboard stuff.

Are you sure you want to keep the clickable object an label instead of an button? You can just take off the border and stuff to make it look like a label?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.