title: how can i copy the text in the textfield cell (in cocoa) to NSPasteboard?
body: <p>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.</p>
  
  <p>in clipboard.h</p>
  
  <pre><code> #import &lt;Cocoa/Cocoa.h&gt;
  
  
   @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
  </code></pre>
  
  <p>in clipboard.m</p>
  
  <pre><code> #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
  </code></pre>
  
  <p>How can i change this to do that?</p>