Make web site - 140 CHAPTER 5 STORING AND RETRIEVING APPLICATION

140 CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA SPECIFYING THE CORRECT DATA TYPE By specifying the correct data type for each piece of data processed by your application, you optimize your application to run as efficiently as possible by conserving the amount of memory required to store data. A trade off exists, however, between your development time and the savings in time your applications may, ultimately, realize if you tweak memory usage to perfection. In more cases, you won t see any tangible improvement in performance no matter how carefully you specify variable data types. As such, you ll probably be best served in 99 percent of all cases by using the following commonly used data types: Boolean, Color, Double, Integer, Single, String, and Variant. As shown in Table 5-1, REALbasic provides support for a wide variety of data types, each of which is designed to store a different type of data. When you instruct REALbasic as to what data type to associate with a particular variable, you tell it what types of actions are permissible when working with the variable. For example, numeric data types, such as an integers, can be added together, but they cannot exceed a maximum value of 2,147,483,647. On the other hand, a special data type, such as a Boolean value, can only be set equal to True or False. Working with Properties Variables directly related to REALbasic objects, such as a window, PushButton, or menu, are referred to as properties of objects. Properties are accessed by name and have specific data types. For example, the Caption property of a PushButton control has a data type of string. Assigning Values to Properties Many properties are available for modification at design time. However, you can also modify most properties programmatically during program execution. The following outlines the syntax for property assignment. ObjectName.PropertyName = Value As you can see, to assign a value to a property, you must identify the name of the owning object, the name of the property, and the value you want to assign to the property. Take note of the dot that separates the ObjectName and PropertyName in the previous example. This is an example of dot notation or dot syntax and is the standard means by which you refer to object attributes like properties. The following shows an example of how to assign a value to a property. PushButton1.Caption = “Cancel” Note Similar dot notation was used back in Chapter 4 to enable access to menu items. Likewise, when you supply the program code required to build the RBCalculator application, which you read about in the section Supplying Application Code, you ll see additional examples of how to programmatically control access to interface elements by modifying control properties.
In case you need quality webspace to host and run your web applications, try our personal web hosting services.

Leave a Reply