hi, I have a textfield cell and a push button in the cocoa . I want to copy the text in teh textfield by clicking on the button.
in clipboard.h
#import <Cocoa/Cocoa.h>
@interface clipboard:NSObject {
IBOutlet id but1;
IBOutlet id numf2_1;
NSPasteboard *pasteBoard;
}
- (BOOL) writeToPasteBoard:(NSString *)stringToWrite;
- (NSString *) readFromPasteBoard;
- (id) init;
//- (IBAction) insert_cb:(id)sender;
@end
in clipboard.m
#import "clipboard.h"
//@implementation clipboard
@implementation clipboard
//- (IBAction) insert_cb:(id)sender{
- (id) init
{
[super init];
pasteBoard = [NSPasteboard generalPasteboard];
return self;
}
- (BOOL) writeToPasteBoard:(NSString *)stringToWrite
{
[pasteBoard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
return [pasteBoard setString:stringToWrite forType:NSStringPboardType];
}
- (NSString *) readFromPasteBoard
{
return [pasteBoard stringForType:NSStringPboardType];
}
@end
How can i change this to do that?