Re: How do you set the text in an NSTextView?
Re: How do you set the text in an NSTextView?
- Subject: Re: How do you set the text in an NSTextView?
- From: Bill Hernandez <email@hidden>
- Date: Fri, 7 May 2010 11:41:20 -0500
GS,
// +---------+---------+---------+---------+---------+---------+---------+---------+
// testAppDelegate.h
// test
// +---------+---------+---------+---------+---------+---------+---------+---------+
#import <Cocoa/Cocoa.h>
@interface testAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
IBOutlet NSTextView *textView;
}
@property (assign) IBOutlet NSWindow *window;
@end
// +---------+---------+---------+---------+---------+---------+---------+---------+
// +---------+---------+---------+---------+---------+---------+---------+---------+
// testAppDelegate.m
// test
// +---------+---------+---------+---------+---------+---------+---------+---------+
#import "testAppDelegate.h"
@implementation testAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
-(void)awakeFromNib
{
NSString *myString = @"this is a string";
[textView insertText:myString];
}
// +---------+---------+---------+---------+---------+---------+---------+---------+
@end
I don't know if this will help at all but, as I have been learning stuff, I have been trying to document what I've learned :
http://www.journey-of-flight.com/bh_xcode/how-to/0010_IB_Outlets_and_Actions/IB_Outlets_and_Actions.php
Best,
Bill Hernandez
Plano, Texas
On May 7, 2010, at 9:33 AM, G S wrote:
> Hi all. I have a couple of tabs on my window, each of which has an
> NSTextView. You have to declare the IBOutlet variable in the app delegate
> as an NSScrollView; only by doing that can you get the outlet to show up on
> the Control-drag to the widget in Interface Builder.
>
> So I have the outlets connected, but an attempt to call setTextValue on the
> textview results in an "unrecognized selector" report. How do you set the
> text in the textView? I tried getting the text container, but no dice.
>
> Thanks!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden