152 CHAPTER 5 STORING AND RETRIEVING APPLICATION (Web design programs)

152 CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Defining Your Own Constants Like variables, REALbasic constants have different scopes depending on how and where they are defined. Specifically, a constant defined within application code stored in an application s window has a local scope, whereas a constant stored in windows or classes can have any of the following scopes, depending on how it is defined: Protected. Accessible only within the window in which it is defined. Private. Accessible only within the window in which it is defined, but not by any windows subclassed from the window. Public. Available throughout your application. Note Classes and subclasses are discussed later in Chapter 8. In addition, constants defined within a module are global in their scope, allowing them to be accessed throughout an application. More information on modules and classes is available in Chapter 8. Working with Local Constants To declare a local constant, you need to use the CONST keyword, which has the following syntax. Const ConstName = Value For example, to define the value of pi as a local constant, you could add the following statement to the code belonging to a window or one of its controls. Const PI = 3.141592 The following provides another example of how to use local constants within your applications. Dim intResults As Integer Const cAppName = “The Happy Holiday Calendar” intResults = MsgBox(”Welcome. Click on OK to Continue”, 64, cAppName) Note In the previous example, the name of the constant was preceded with the letter c to label it as a constant. This makes the constant stand out better in your code.
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Leave a Reply