Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Instant Cocoa

Article

Issue: 1.5 (April/May 2003)
Author: Colin Cornaby
Author Bio: Colin Cornaby is an OS X developer. He is currently working on a new project, which will probably be out by the time you read this.
Article Description: No description available.
Article Length (in bytes): 4,544
Starting Page Number: 43
RBD Number: 1523
Resource File(s): None
Related Link(s): None
Known Limitations: None

Excerpt of article text...

In the last column we built a program in Cocoa that displayed a sheet attached to a window. You learned to create a class to hold your code, how to add an outlet to your class, and how to create an action. This time we'll create a new project that will create variables in Cocoa, retrieve data from your interface, and practice sending data from your code back to the user.

First, you need to create a new Cocoa application project in Project Builder. For this exercise, you can name it anything you wish (although I named mine RBDExampleApp). Be careful about giving your application a name with a space in it. Project Builder has issues with projects that have spaces in their names.

You should then open your nib and lay out the window to look like the one in Figure 1. You will need to add two text boxes, and a button. After you have laid out the interface, create a new class. Name your new class "interfaceController", and add two outlets to it. Name one outlet "firstTextField" and the other outlet "secondTextField". Also add an action called "moveTheText". Create the files for your class, and then instantiate the class. Link the outlets up to the appropriate fields (firstTextField to the first text field, secondTextField to the second), and link the button to the action. Remember that it matters which direction the link is drawn. Refer back to the last column if you need to. When you are done, save the nib and close Interface Builder.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com