X web hosting - CHAPTER 6 Making Decisions with

April 28th, 2008

CHAPTER 6 Making Decisions with Conditional Logic To create truly useful applications, you need to provide your programs with the capability to analyze data, and then make logical decisions based on the results of that analysis. This is achieved through the execution of conditional statements that work with mathematical, comparison and logical operators to define conditional tests and the courses of action to take, based on the results of the test. By applying conditional programming techniques demonstrated in this chapter, you can develop REALbasic applications that react dynamically to different data and provide users with an interactive experience. Specifically, you learn how to Test between two or more conditions Alter the logical flow of your program code Generate random numbers Apply operating system-specific conditional logic Implementing Conditional Logic By default, REALbasic executes code statements in a sequential order. For example, if you specified a set of ten code statements to be executed when the user clicks a PushButton control, REALbasic executes each statement, one at a time, in the order the statements were written. This type of execution works just fine much of the time. In some situations, though, you might want to conditionally execute a block of statements. For example, suppose you wrote an application that continually writes text to a log file. Before writing to the log file, you would want to add logic to your program to make sure the log file exists. If the log file does not exist, then you would want to tell REALbasic to create the file first. In this scenario, the code statement that checks for and creates a new log file only runs when the application determines that a log file does not already exist. Otherwise, these statements are skipped. Adding this type of conditional check to your application can help prevent errors by ensuring the application always has a log file to write to. Conditional logic within a computer program is only a matter of determining whether a condition evaluates to either True or False and specifying what actions to take based on the results of the test. REALbasic provides you with three sets of programming statements that you
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA (My web site)

April 27th, 2008

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Button1.Enabled = True Button2.Enabled = True Button3.Enabled = True Button4.Enabled = True Button5.Enabled = True Button6.Enabled = True Button7.Enabled = True Button8.Enabled = True Button9.Enabled = True Button0.Enabled = True DecimalButton.Enabled = True NegativeButton.Enabled = True These statements reenable the application s PushButton controls to let the user enter a new equation. Testing RBCalculator If you have not done so yet, go ahead and save your application, and then compile it and see how it operates. Double-check your typing if any errors are flagged. Once everything is working properly, compile a standalone copy of your application, pass it on to your friends, and ask them to test it as well. Summary In this chapter, you learned the fundamentals of storing and retrieving data in REALbasic applications. This included learning how to work with variables, arrays, dictionaries, and constants. You were introduced to the concept of variable scope. You learned how to document your applications by adding comments and notes. On top of all this, you learned about different data types and how to convert data from one data type to another.
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

160 CHAPTER 5 STORING AND RETRIEVING APPLICATION (Web hosting bandwidth)

April 26th, 2008

160 CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA This statement uses a series of REALbasic functions to process the equation the user enters. Here is a step-by-step breakdown of what happens when this statement executes. 1. The Instr function is used to locate the position of the + character in the equation. 2. This information is then fed to the Left function, which uses it to extract all the characters from the beginning of the text string to the + character. 3. The Val function is used to convert the remaining value to a number. 4. The Instr function is again used to locate the position of the + character in the equation. 5. The Mid function is then used to extract the remainder of the text in the EditField, starting two character positions to the right of the + character. 6. The Val function is then used to convert the remaining value to a number. 7. Finally, the numeric value extracted from step 3 is added to the numeric value extracted in step 6 and assigned to the intResult variable. Note Refer to REALbasic s online reference (Help . Language Reference) for detailed explanations of the syntax for various REALbasic functions. The remaining If Then blocks are designed to perform a similar set of steps for the subtraction, multiplication, and division operations. The first statement following the last If Then block converts the value of intResult to a String and displays the results in the EditField control (named OutputField). The remaining statements disable all the PushButton controls on the application, except for the PushButtons representing the Equals, Off, and Clear operations. Now, add the following statement to the PushButton control representing the Off button. Quit As you can see, this statement simply terminates the application when this PushButton control is clicked. Finally, add the following statements to the PushButton control representing the Clear button. OutputField.Text = “” PlusButton.Enabled = True MinusButton.Enabled = True DivisionButton.Enabled = True MultiplicationButton.Enabled = True
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

CHAPTER 5 STORING (Web hosting domain names) AND RETRIEVING APPLICATION DATA

April 25th, 2008

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA If InStr(OutputField.Text, ” - “) > 0 Then dblResult = Val(OutputField.Text.Left(Instr(OutputField.Text, _ ” - “))) Val(OutputField.Text.Mid(Instr(OutputField.Text, _ ” - “) + 2)) End If If InStr(OutputField.Text, ” * “) > 0 Then dblResult = Val(OutputField.Text.Left(Instr(OutputField.Text, _ ” * “))) * Val(OutputField.Text.Mid(Instr(OutputField.Text, _ ” * “) + 2)) End If If InStr(OutputField.Text, ” / “) > 0 Then dblResult = Val(OutputField.Text.Left(Instr(OutputField.Text, _ ” / “))) / Val(OutputField.Text.Mid(Instr(OutputField.Text, _ ” / “) + 2)) End If OutputField.Text = Str(dblResult) Button1.Enabled = False Button2.Enabled = False Button3.Enabled = False Button4.Enabled = False Button5.Enabled = False Button6.Enabled = False Button7.Enabled = False Button8.Enabled = False Button9.Enabled = False Button0.Enabled = False DecimalButton.Enabled = False NegativeButton.Enabled = False The first statement declares a variable named intResult with a data type of Double to ensure the calculator can handle nearly any number the user might enter. The next four sets of statements are If Then blocks, each of which is designed to handle a particular operation. The first If Then block is set up to look for the presence of a + character in the equation entered by the user. If present, then the following statement is executed. dblResult = Val(OutputField.Text.Left(Instr(OutputField.Text, ” + “))) + Val(OutputField.Text.Mid(Instr(OutputField.Text, “+”) + 2))
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

158 CHAPTER 5 STORING AND RETRIEVING APPLICATION (Web space)

April 25th, 2008

158 CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Next, add the following statements to the method belonging to the DecimalButton control. Dim intResult As Integer If intResult = Instr(OutputField.Text, “.”) Then OutputField.Text = OutputField.Text + Me.Caption End If The first statement defines a local variable named intResult. The If Then block that follows uses the Instr function to determine whether a decimal has already been entered before appending a decimal character to whatever text is stored in the EditField control. In other words, because a number can only have a maximum of 1 decimal, the If Then statement prevents the user from accidentally entering a second decimal when keying in a number. Likewise, add the following code to the PushButton controls representing plus, minus, multiplication, and division buttons. OutputField.Text = OutputField.Text + ” ” + Me.Caption + ” ” PlusButton.Enabled = False MinusButton.Enabled = False DivisionButton.Enabled = False MultiplicationButton.Enabled = False The first statement adds a plus (+) character to the string displayed in the EditField control. Note, this statement also adds a blank space before and after the plus character. The next four statements disabled the buttons representing the plus, minus, division, and multiplication buttons. Remember, the RBCalculator only supports one calculation at a time, which is enforced by disabling these buttons as soon as the user clicks one of them. These buttons are reenabled later when the user clicks the Clear button to allow a new equation to be entered. Another limitation of the RBCalculator is that is only lets you work with one decimal number as a time. Next, add the following code statements to the PushButton control representing the equals button. Dim dblResult As Double If InStr(OutputField.Text, “+”) > 0 Then dblResult = Val(OutputField.Text.Left(Instr(OutputField.Text, _ ” + “))) + Val(OutputField.Text.Mid(Instr(OutputField.Text, _ “+”) + 2)) End If
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA (Zeus web server)

April 24th, 2008

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Object Property Value PushButton16 Name DivisionButton Caption / PushButton17 Name EqualsButton Caption = PushButton18 Name OffButton Caption Off PushButton19 Name ClearButton Caption Clear The next step in creating the RBCalculator application is to design its menu system. Double- click the menu bar item located on the Projects screen to open the MenuBar Editor. Delete the Edit menu. Then, modify the menu system for Menubar1 by adding a Help menu, and then add an About menu item beneath it. Assign &Help and &About as the value of the Text properties for each respective control. At this point, the user interface for the RBCalculator application is finished. Now, you are ready to begin writing the code statements required to make the application work. Supplying Application Code Let s start adding the code statements associated with the Help menu s About menu item. To do so, open the application s window in the REALbasic Code Editor and switch over to code view. Click the Add Menu Event Handler button located on the Window Editor toolbar. A menu handler entry is added to the left-hand browser area in the Code Editor. Select the entry for the HelpAbout menu item from the drop-down list for the MenuItem Name field and enter the following program statement. MsgBox(”RBCalculator - Written By Jerry Ford - 2006″) This statement uses the MsgBox function to display information about the application s author in a preformatted pop-up dialog window. Now that the application s menu system is ready to go, it s time to provide the code associated with each of the application s PushButton controls. For starters, add the following code statement to the method belonging to each of the PushButton controls that represents a numeric calculator button, as well as to the button representing a toggle value (for example, the PushButtons labeled 0 9 and -). OutputField.Text = OutputField.Text + Me.Caption This statement, when executed, adds the number of the appropriate PushButton control to the EditField control. For example, if the user clicks the PushButton control representing the number 5, this statement takes the value of that PushButton control s Caption (for example 5), which it gets from Me.Caption, and appends it to whatever text is currently displayed in the EditField control.
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.

Shared web hosting - 156 CHAPTER 5 STORING AND RETRIEVING APPLICATION

April 23rd, 2008

156 CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Next, add 19 button controls to the window, as shown in Table 5-4, and modify the Name property for each control. Table 5-4. Property Modifications RBCalculator PushButton Controls Object Property Value PushButton1 Name Button1 Caption 1 PushButton2 Name Button2 Caption 2 PushButton3 Name Button3 Caption 3 PushButton4 Name Button4 Caption 4 PushButton5 Name Button5 Caption 5 PushButton6 Name Button6 Caption 6 PushButton7 Name Button7 Caption 7 PushButton8 Name Button8 Caption 8 PushButton9 Name Button9 Caption 9 PushButton10 Name Button0 Caption 0 PushButton11 Name DecimalButton Caption . PushButton12 Name NegativeButton Caption PushButton13 Name PlusButton Caption + PushButton14 Name MinusButton Caption PushButton15 Name MulitiplicationButton Caption *
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA (Web design careers)

April 22nd, 2008

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Figure 5-6. RBCalculator is a basic desktop calculator application, as shown on Macintosh. Note As you work your way through the creation of this application, you should be able to follow along and understand the interaction that occurs when the application accesses properties and variables. For pieces of code that have not yet been explained, go ahead and enter them exactly as shown. Once you finish reading Chapter 6, you may want to revisit this example. By that time, you should be ready to take another look at how this application works. Designing the User Interface Users interact with the RBCalculator application through PushButton controls placed on the main application window. Calculations and their results are displayed in an EditField control placed at the top of the window. In addition, a small menu system is available that enables the user to close the application or display additional information about it. To begin the development of this application, open a new project in REALbasic, add the controls listed in Table 5-3, and then modify the window and control properties as shown. Table 5-3. Window and Property Modifications for the RBCalculator Application Object Property Value Window1 Name MainWindow Title RBCalculator EditField1 Name OutputField ReadOnly Enabled Alignment Right Bold Enabled
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

154 CHAPTER 5 (Web design rates) STORING AND RETRIEVING APPLICATION

April 21st, 2008

154 CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Reserved Keywords REALbasic reserves a collection of keyword terms that makes up its programming language. You cannot use these keywords when naming variables, arrays, modules, constants, and so on within your applications. Table 5-2 provides a complete listing of REALbasic s reserved keywords. Table 5-2. REALbasic Reserved Keywords And Array As Boolean ByRef ByVal Call Case Catch Class Color Const DebugPrint Declare Dim Do Double Downto Each Else ElseIf End Event Exception Exit False Finally For Function GoTo Handles If Implements In Loop Me Mod Module Namespace New Next Nil Not Object Of Or Private Protected Public Raise ReDim REM Return Select Self Shared Single Static Step String Sub Then To True Try Until Wend Creating a Starter Desktop Calculator To help further reinforce the information you learned in this chapter, this section shows you how to create a new desktop application called RBCalculator, which is a relatively simple implementation of a desktop calculator. The programming logic required to create a full- featured calculator application is too extensive to replicate here. Instead, the programming logic implemented in this application is limited to solving basic addition, subtraction, multiplication, and division, and equations consisting of two numbers. As a desktop calculator, all key functionality is provided via PushButton controls and an EditField located on the application window. In addition, the application has a small menu system made up of File and Help menus, as Figure 5-6 shows.
You want to have a cheap webhost for your apache application, then check apache web hosting services.

CHAPTER 5 STORING AND RETRIEVING APPLICATION (Web design software) DATA

April 20th, 2008

CHAPTER 5 STORING AND RETRIEVING APPLICATION DATA Here, a constant named cAppName is defined and assigned a string of text. The constant is then used to display the name of the application in a pop-up dialog box generated by the MsgBox function, as Figure 5-4 shows. Once defined, a constant can be referred to over and over again. Figure 5-4. Constants provide a way to define data within your applications that cannot be changed during program execution, as shown on Windows. Adding a Constant to a Window Constants defined within a window can have a public, protected, or private scope. The following procedure outlines the steps involved in adding a constant to a window. Note The procedure you follow to declare a constant within a module and a class is practically identical to the procedure used to declare one within a window. The only difference is this: with modules, your choices for scope are Global, Public, and Protected, instead of Public, Protected, and Private. 1. Open the Code Editor for the appropriate window. 2. Click the Add Constant button or click Project . Add . Constant. The Add Constant declaration field is displayed. 3. Enter a name, data type, and value for the constant. 4. Click one of the three scope buttons located to the right of the Declaration field, as shown in Figure 5-5. Figure 5-5. REALbasic lets you select a scope by clicking the Public, Protected, or Private buttons, as shown on Linux.
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.