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










