A First Program | ||
![]() | ||
If you haven't already read the "What Is A Program Anyway?", "What's an OOP?", and "The IDE" pages you are strongly advised to do so before starting on the tutorials since the tutorials assume familiarity with the ideas discussed on these pages. A First Program To get started launch REALbasic® and add an EditField and a PushButton to Window1 (drag an editfield and a pushbutton from the Controls palette to Window1). You are building your program's interface when you do this (remember the 3 parts of a program?). If necessary open the Properties Window. Click on the PushButton to display PushButton1's properties. In the properties window change PushButton1's caption to "Show Message". In Window1 widen the button so that its new caption can be seen. | ||
Now we will add some code to the PushButton so that it can respond when it is clicked. Double-click the button in Window1. This opens the Code Editor window for Window1. Because you clicked on PushButton1 the IDE has placed the text cursor in the Action event of PushButton1. This is nice since this is where you want to put your code. Type in the code shown below: | ||
![]() | ||
Now would be a good time to save your project. Select "Save" from the File menu. In the save dialog enter "Tutorial1" as your project name, navigate to where you want to save it and click the Save button. Testing Your First Program To make your project into a true double-clickable application you need to "build" it. Go to the File menu and choose Build Settings... In the window that appears use the popup menu and select Macintosh Settings. At the top of the settings window check the system(s) on which you want to be able to run your application. If you are going to be running your application on OS 9 fill in a Macintosh Name. If you are going to be running your application on OS X fill in an OS X Name. You can ignore the other settings and click the OK button. Now select Build Application from the File menu. A progress window should appear. After REALbasic® has finished building your application it will open the folder that contains your project (and now, your application as well) and select your application. It will have a generic application icon. Double-click your application to try it out. Congratulation! You have just created a REAL computer program. | ||