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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VCL Components<br />

The InitialDir Property<br />

The InitialDir property is used to specify the directory that will be used as the <strong>in</strong>itial<br />

directory when the File dialog box is displayed. If no value is supplied for the InitialDir<br />

property, the current directory will be used (as determ<strong>in</strong>ed by W<strong>in</strong>dows).<br />

TIP<br />

A top-notch W<strong>in</strong>dows program keeps track of the last directory the<br />

user used both when open<strong>in</strong>g files and when sav<strong>in</strong>g them. Usually this<br />

<strong>in</strong>formation is stored <strong>in</strong> the Registry. Before display<strong>in</strong>g a File Open or<br />

File Save dialog box, set the InitialDir to the previous directory the<br />

user used. After the user selects a file, update the registry to reflect the<br />

new directory if necessary.<br />

The Options Property<br />

The Options property controls the way the File dialog box is used. The list of options is too<br />

long to list here, but common items <strong>in</strong>clude whether you allow new files or directories to be<br />

created, whether the Help button is shown on the dialog box, whether long filenames are<br />

allowed, whether multiple file selection is allowed, and others. See the <strong>C++</strong>Builder onl<strong>in</strong>e<br />

help for the OpenDialog and SaveDialog components for complete <strong>in</strong>formation.<br />

The Title Property<br />

The Title property is used to set or read the title of the File dialog box. If no title is specified,<br />

the common dialog box defaults of Open for the OpenDialog component and Save for the<br />

SaveDialog component will be used.<br />

TIP<br />

A Save As dialog box is noth<strong>in</strong>g more than a SaveDialog component<br />

with the Title property set to Save As.<br />

The File dialog boxes have no events associated with them.<br />

TIP<br />

You can implement a File Open dialog box (or any of the common<br />

dialog boxes) at runtime without ever plac<strong>in</strong>g an OpenDialog component<br />

311<br />

8

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

Saved successfully!

Ooh no, something went wrong!