07.05.2015 Views

Download - True BASIC

Download - True BASIC

Download - True BASIC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

151<br />

Interface Elements<br />

CHAPTER<br />

14<br />

Graphical user interfaces, such as Windows, OS/2, and Macintosh, use menus, buttons, windows, and dialog boxes<br />

to make applications easier to use. With <strong>True</strong> <strong>BASIC</strong>, you can create and control such objects in your own programs.<br />

The easiest way to do this is with the <strong>True</strong> Controls and <strong>True</strong> Dials libraries of subroutines provided with<br />

the language.<br />

<strong>True</strong> Controls is a library of subroutines that let you manage windows, menus, graphical objects, buttons, edit<br />

areas, and other interface elements from your <strong>True</strong> <strong>BASIC</strong> programs. <strong>True</strong> Dials is a similar library of routines<br />

that let you create dialog boxes as part of your programs. This chapter explains how you can create user-interface<br />

elements using the routines from these two libraries.<br />

The routines described in this chapter are relatively easy to use, allow control of all user-interface elements, and,<br />

in most instances, will meet all of your needs. (Advanced users might want to gain further control of interface elements<br />

through direct use of the built-in subroutines OBJECT and TBD. All of the user-interface “objects” are ultimately<br />

controlled by these two extremely powerful and complex subroutines. The OBJECT subroutine is used by<br />

all the <strong>True</strong> Controls routines, while <strong>True</strong> Dials routines call the TBD routine to create and display all dialog<br />

boxes and return the user’s response. Advanced programmers who wish to use the OBJECT and TBD routines<br />

directly should refer to the reference sections (see Chapters 19 and 21). Examining the source code of TRUEC-<br />

TRL.TRU in the TBLIBS folder should help.)<br />

The example programs ARCHERY2.TRU, DAYCALC.TRU, PISTON.TRU, and SURVIVE.TRU (in the<br />

TBDEMOS directory) provide a good overview of how the convenience routines described in this chapter may be<br />

used to enhance programs. The TBDEMOS directory also contains several programs that illustrate the individual<br />

objects; those programs have names that begin with DEM.<br />

User Interface Objects and Controls<br />

The <strong>True</strong> Controls routines let you create and control the following objects or controls:<br />

Window<br />

Menu<br />

Push button<br />

Radio group<br />

Check box<br />

Group box<br />

Static text<br />

Edit field<br />

List box<br />

List button<br />

List edit button<br />

Graphics<br />

Scroll bar<br />

Text editor<br />

Physical window<br />

Pop-down selections for a window’s menu bar<br />

Push button with text<br />

Several radio buttons, only one of which can be on, with text<br />

Text with check box that may be checked on or off<br />

Box with or without a title<br />

One-line piece of text that cannot be edited<br />

One-line text input region that can be edited<br />

A (scrollable) selection list of items<br />

Button with a pop-down selection list<br />

Edit field with a pop-down selection list<br />

Several types of graphics objects<br />

Horizontal or vertical scroll bar<br />

Fully-scrollable text-edit object

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!