Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbye with .. a button :-))



Hi Riccardo:
The information you are looking for is not in the NSTextField documentation, but in the NSControl documentation, NSTextField's superclass. You can find it in the Cocoa Reference docs others have sent links to. Welcome to the joys of subclasses!

FYI, the method you are looking for is stringValue. You can retrieve the value of any control as a string by using this method:

[myControl stringValue]

Likewise, you can set the value of any control as a string by using the method:

[myControl setStringValue: @"The String"] ;

This is a great aspect about Cocoa because it allows you to replace controls with other controls without changing any code. I recently changed a user interface widget on the program I am working on from a stepper to a slider without changing any code...it was very exciting! :-)

Cheers,
-Charles

On Tuesday, July 31, 2001, at 07:28 AM, Riccardo Santato wrote:

Hi everybody,

I'm new to COCOA, NexTStep and other things but I wanted started programming with OS X using Cocoa and Objective - C.
The question is I wanted to create a very simple program : a cocoa app in which by pressing a button you will see a string appearing on a textfield... quite simple, isn't it ? :-))

I can't manage to get things work; here's the passages I've done...

1) Create the interface
2) create a subclass of NSObject with an outlet and an action in it
3) Istantiate the subclass
4) Made the connections in a correct way ( I used printf to check it)

Now in the developer docs I can't find the way to make my cocoa app modify the inside of the textfield. What method have I to give it ?
Where can I find it on the documentation on my hard disk (tidy X and developer tools installation) ?

Thank you for your help .

--
Riccardo Santato
www.riccardosantato.com
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Newbye with .. a button :-)) (From: Riccardo Santato <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.