Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Beginning REALbasic - From Novice To Professional (2006)

.pdf
Скачиваний:
233
Добавлен:
17.08.2013
Размер:
18.51 Mб
Скачать

46

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

Figure 2-10. REALbasic controls, seen here on Mac OS X, provide the basic building blocks for building your application’s GUI.

Controls are prebuilt interface-development elements that form the building blocks on which you design your application’s windows. Each instance of a control you add to a window can be customized. For example, using its resizing handles, you can resize it. You can also move it to a different location within the window. Finally, you can select it to view and modify its properties, which will be visible in the Properties pane.

Note Visual Basic programmers should see many similarities between the Visual Basic Control toolbar and the REALbasic Controls pane. In many cases, REALbasic provides exactly the same functionality in its controls as is found in Visual Basic Controls, just with different control names.

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

47

Note, at the top of the Controls pane is a drop-down list. This drop-down list provides access to any of the four Controls categories, as you can see in the following list.

Built-in. The default collection of controls displayed by REALbasic.

Project. Custom-built controls added to the project via the Project Editor.

Plug-in. Third-party controls added to REALbasic by copying them into the REALbasic Plug-ins folder.

Favorite. Controls you marked as favorites.

Note You can add a control to a window by dragging-and-dropping it from the Controls pane onto the window in the Windows Editor. You can also add a Control by double-clicking it in the Controls pane.

You can use the Window Editor to modify any window you added to your project by double-clicking the window in the Projects Editor. REALbasic responds by opening the Window Editor and displaying the selected window. In addition, a new entry is added to the Tab bar for the Window Editor.

The name of the Default Window for any REALbasic project is Window1. You may add other windows as needed by your applications by clicking the Add Window icon on the Project Editor toolbar. When you finish editing the window’s GUI, you can close it by clicking the Close box in the Tab bar associated with the window.

Because the space available to you when working with the Window Editor is limited, REALbasic has horizontal and vertical scroll bars on the top and right-hand side of the window editing area. This enables you to move the window you are working with without having to resize the REALbasic IDE or to hide its toolbars temporarily (via commands located on the View menu).

The Menu Editor

The REALbasic Menu Editor, shown in Figure 2-11, provides you with everything you need to create a robust menu system for your REALbasic applications. The Menu Editor consists of two panes. The left pane displays the contents of the menu being developed. The right pane displays the properties associated with the selected menu, submenu, or menu item.

48

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

Figure 2-11. REALbasic preconfigures a default menu, as demonstrated on Mac OS X, for every new application.

Note One area where REALbasic and Visual Basic differ somewhat is the manner in which application menus are developed. Programmers with a Visual Basic background may want to jump ahead to Chapter 4 to investigate how menu development works in REALbasic.

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

49

PREVIEWING OS-SPECIFIC VERSIONS OF YOUR MENU SYSTEM

REALbasic displays a set of four icons on the left-hand side of the Project toolbar whenever the Menu Editor is displayed. Each of these icons represents one of the OSs supported by REALbasic (Windows, Mac OS X, Classic MAC OS, and Linux). By clicking these icons, you can get a sneak peek at how your application’s menu will look when it’s run on different OSs.

By default, REALbasic automatically creates File and Edit menus for every new application. In addition, REALbasic automatically adds a number of menu items to these two menus, as shown in Table 2-1. As already noted, REALbasic also creates an Apple and REALbasic menu for REALbasic applications compiled to run on the Macintosh OS.

Table 2-1. REALbasic Default Application Menu and Menu Items

Menu

Menu Item

File

Exit

Edit

Undo

 

Cut

 

Copy

 

Paste

 

Delete

 

Select All

 

 

For more detailed information on how to use the Menu Editor to create and work with REALbasic menus, read Chapter 4.

The Code Editor

You use the Code Editor to type in the program statements for your applications. The REALbasic Code Editor is divided into two panes. The left pane has a browser-like feature that lets you view and select the objects that make up your application. The right pane provides the workspace where you type in your application’s programming statements.

In the Code Editor’s browser area, shown in Figure 2-12, you see a listing of all the objects that make up your applications. Each object, be it a window or a control or any other object element, has a collection of events associated with it.

50

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

Figure 2-12. REALbasic’s Code Editor, as shown on Windows, provides helpful features, such as automatic code indentation and keyword color coding.

Note An event is an action initiated by the user or the application itself. REALbasic is able to detect the occurrence of these events and execute programming statements you associate with them. For example, if the user clicks a PushButton control you added to an application window, the Action event associated with that PushButton is executed. If you supplied any program code for that PushButton’s Action event, it is automatically executed.

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

51

REALbasic’s Tips Bar

One easily overlooked, but exceptionally helpful, feature of REALbasic is the Tips bar located at the bottom of the IDE. Each time you compile an application, REALbasic checks the syntax of your application’s programming statements. If it detects an error, REALbasic displays a description of the error in the Tips bar. By looking for this error message, you may be able to quickly determine what went wrong without having to dig through your program code looking for the source of the problem.

REALbasic uses the Tips bar to provide you with all kinds of additional information. For example, REALbasic keeps an eye on what you are doing as you work within the IDE and, when appropriate, displays hints in the Tips bar. For example, as Figure 2-13 demonstrates, REALbasic uses the Tips bar to display information about menu and icons, as well as other items found in the IDE.

Figure 2-13. REALbasic uses the Tips bar, as shown here on Linux, to provide you with helpful information as you work within the IDE.

52

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

REALbasic also uses the Tips bar to display syntax information as you type in your code statements. For example, Figure 2-14 shows an example of how REALbasic displays the syntax required to format a particular programming statement.

Figure 2-14. REALbasic displays command syntax, as shown here on Linux, to help you properly formulate statements as you enter your program code.

REALbasic’s Integrated Help Features

From time to time, even the most experienced programmer needs a little help. Fortunately, the REALbasic IDE provides easy access to all of REAL Software’s REALbasic documentation. You can find these resources located on REALbasic’s Help menu. These resources include access to electronic copies of REALbasic manuals and links to online resources at the REALbasic website, as well as access to REALbasic’s Reference Manual.

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

53

DOWNLOADING REALBASIC’S DOCUMENTATION

Copies of the Getting Started, Tutorial, and User’s Guide manuals are available as free downloads from the REALbasic website at http://www.realsoftware.com/download/windows/, http://

www.realsoftware.com/download/mac/, and http://www.realsoftware.com/download/ linux/. In addition, you can download a copy of the PDF version of REALbasic’s Language Reference manual from each of these web pages.

Note REALbasic’s online documentation is provided in PDF format. You’ll need a copy of the Adobe Acrobat Reader or a similar application installed on your computer before you can view this documentation.

Accessing REALbasic’s Manuals

REALbasic provides access to three manuals. Each of these manuals is designed to serve a different purpose. These manuals include

Getting Started. A small REALbasic manual designed as an introduction to REALbasic by guiding the reader through the creation of a sample application.

Tutorial. A REALbasic manual designed to provide the reader with a thorough introduction by demonstrating how to create a word-processing application.

User’s Guide. A REALbasic manual designed to provide a complete overview of REALbasic programming.

Note REALbasic’s Tutorial and User’s Guide are not installed with REALbasic. Instead, you are prompted to download them the first time you try to access them from the Help menu.

Accessing REALbasic Online Resources

REALbasic’s Help menu also provides easy access to two useful online links available at the REALbasic website. These resources include

REALbasic on the Web. Opens your default web browser and loads www.realbasic.com, REALbasic’s official website.

REALbasic Feedback. Opens your default web browser and loads http:// www.realsoftware.com/feedback/, as Figure 2-15 shows. This web page enables you to report problems and submit enhancement requests.

54

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

Figure 2-15. REALbasic makes it easy to report errors or submit enhancement requests, as shown here on Mac OS X.

Working with REALbasic’s Electronic Language Reference

REALbasic’s Help menu also provides you with access to an electronic copy of the REALbasic Language Reference, shown in Figure 2-16.

C H A P T E R 2 N A V I G A T I N G T H E R E A L B A S I C I N T E G R A T E D D E V E L O P M E N T E N V I R O N M E N T

55

 

 

 

 

 

 

Figure 2-16. The REALbasic Language Reference provides easy access to information about REALbasic programming language elements, as shown here on Mac OS X.

Tip In addition to accessing the Language Reference from the REALbasic Help menu, you can also open it by either pressing the F1 key or using CTRL-/ on Windows or Linux or by pressing the z-? key on Macintosh.

The REALbasic Language Reference is organized into three panes. The left-most pane contains a listing of high-level categories where major programming language elements are logically grouped. When you select a category, a listing of available subcategories is displayed in the middle pane. When you select a subcategory entry, a list of topics is displayed in the right-most pane. To view the available information for any given topic, click its entry in the right pane. For example, Figure 2-17 shows an example of the reference information available for the If…Then…Else statement.