12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>C++</strong> Class Frameworks and the Visual Component Model<br />

TRichEdit, TImageList, TStatusBar, and a few others. Some of these controls are, by nature,<br />

complicated, and the VCL classes that represent them are fairly complicated as well. Trust<br />

me when I say that VCL does a great deal to ease the burden of work<strong>in</strong>g with these common<br />

controls. You’ll have to spend some time with these classes before you fully understand them.<br />

Database Component Classes<br />

VCL has a host of database components, which <strong>in</strong>clude both visual and nonvisual classes.<br />

Nonvisual database components <strong>in</strong>clude TDataSource, TDatabase, TTable, and TQuery. These<br />

classes encapsulate beh<strong>in</strong>d-the-scenes database operations.<br />

Visual database component classes are the part of the VCL database operations that users can<br />

see and <strong>in</strong>teract with. For <strong>in</strong>stance, a TDBGrid component is used to give users access to a<br />

database table that might be represented as a TTable component. In this way, the TDBGrid acts<br />

as the <strong>in</strong>terface between the user and the TTable. Through the TDBGrid, the user can view and<br />

edit the database table on disk.<br />

The TDBNavigator component provides buttons that allow the user to move through a<br />

database table. This class <strong>in</strong>cludes buttons for next record, previous record, first record, last<br />

record, cancel edit, accept edit, and undo edit.<br />

Other data-aware component classes hook standard W<strong>in</strong>dows controls to database fields.<br />

These classes <strong>in</strong>clude TDBText, TDBEdit, TDBListBox, and TDBImage, among others.<br />

Common Dialog Classes<br />

As you are no doubt aware, W<strong>in</strong>dows has common dialog boxes for th<strong>in</strong>gs like open<strong>in</strong>g files,<br />

sav<strong>in</strong>g files, choos<strong>in</strong>g fonts, and choos<strong>in</strong>g colors. VCL encapsulates these common dialog<br />

boxes <strong>in</strong> classes represent<strong>in</strong>g each type. The classes are TOpenDialog, TSaveDialog, TFontDialog,<br />

TColorDialog, TPr<strong>in</strong>tDialog, and TPr<strong>in</strong>terSetupDialog. VCL also adds the TF<strong>in</strong>dDialog and<br />

TReplaceDialog classes to this group of components. These components are nonvisual <strong>in</strong> that<br />

they do not have a design-time <strong>in</strong>terface that you can see. The dialog boxes are visible when<br />

displayed at runtime, of course.<br />

System Component Classes<br />

The System tab on the Component Palette conta<strong>in</strong>s a mixture of visual and nonvisual<br />

components. The TTimer class is used to represent a W<strong>in</strong>dows system timer. Its s<strong>in</strong>gle event<br />

is OnTimer, which is called each time the timer fires. The timer <strong>in</strong>terval is set through the<br />

Interval property. TTimer is a nonvisual component.<br />

VCL <strong>in</strong>cludes several component classes that allow you to build your own custom File Open<br />

or File Save dialog box. The classes are TFileListBox, TDirectoryListBox, TDriveComboBox,<br />

and TFilterComboBox.<br />

159<br />

5

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

Saved successfully!

Ooh no, something went wrong!