Thanks everyone, I had stumbled across the setIntValue in one of the Apple
Cocoa pdf's, and it was not listed in the Dev Docs for NSTextField but I
did find it in the NSCell API.
Thanks again,
tom
Mon, February 5, 2007 10:57 am, Ricky Sharp wrote:
Feb 5, 2007, at 12:38 PM, tjones (AT) acworld (DOT) com wrote:
>
>
>I'm brand new to Cocoa, I have been using RealBasic and AppleScript
>Studio
>for a long time and have finally decided to learn Cocoa.
>>
>K, so I have created a simple little app which has a button which
>set the contents of a NSTextField to a integer, and this works fine. I
>even figured out how to change the color. I just can't seem to figure out
>how to set text in the TextField.
>>
>Here is my code I was trying.
>>
>>
>Thanks,
>tom
>>
>>
>- (IBAction)setTextFieldTo:(id)sender
>{
>// This works
>//[textField setIntValue:2];
>>
>>
>NSString *myText;
>myText = @"Hello World";
>>
>[textField setString: myText];
>[textField setToolTip: @"Hello Tool Tip!"];
>[textField setTextColor: [NSColor greenColor]];
>}
>>
>
As I.S. just pointed out, use setStringValue:
--
thing I wanted to point out though is that if you had an
NSTextView instead of NSTextField, then you would be able to use
setString: (NSTextView inherits from NSText which provides a
setString:). However, NSTextField does not inherit from NSText.
--
Typically, you can get nice compiler warnings about this (e.g.
'textField may not respond to setString:') My guess is that you
declared textField as an id (which is a perfectly valid thing to do),
instead of the more specific type of NSTextField*.
Ricky A. Sharp mailto:rsharp (AT) instantinteractive (DOT) com
Instant Interactive(tm)
>
>
>
Cocoa-dev mailing list (Cocoa-dev (AT) lists (DOT) apple.com)
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:
%40developershed.com
This email sent to bsdarchive (AT) developershed (DOT) com