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:

Beginner's Column

Building a Calculator

Learning to use REALbasic Modules within a project

Issue: 2.3 (December/January 2003)
Author: Thomas J. Cunningham
Author Bio: Thomas is a hobbyist programmer who enjoys sharing the RB loving with others. His online RB Beginner tutorial has had over 20,000 hits!
Article Description: No description available.
Article Length (in bytes): 8,551
Starting Page Number: 28
RBD Number: 2312
Resource File(s):

Download Icon 2312.sit Updated: Thursday, December 18, 2003 at 9:58 AM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

This month we will learn to use a Module in a project. A Module is a unique and valuable construct in RB. It is an area of our program where we can store things that are "global" to our program. The term "global" in RB can be a bit confusing and needs to be qualified since a Window or Application Class property can also be termed global.

In a window, we can declare properties that are global. However, there are a few subtleties here. If another object or class wants to refer to this window property, you have to use dot notation to get to it. For example, a property declared on MainWindow called mName is referred to by calling MainWindow.mName. If mName is declared as Protected, only objects in the MainWindow may refer to the property. Another window may not access this private property directly. The same principle can be applied to an Application class.

A Module is similar to a class, but it is not a class. A Module does not need to be instantiated by your project -- once it is added to your project, it always exists. A Module can store three global items: Constants, Methods, and Properties. It has no Events. Note that one of the more useful ways a Module is used -- which I will not discuss here -- is the localization of your program to different languages.

...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