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.

310 Day 8<br />

The Files Property<br />

Files, a read-only property, is a TStr<strong>in</strong>gs <strong>in</strong>stance that conta<strong>in</strong>s the list of files selected when<br />

multiple file selection is enabled.<br />

The Filter Property<br />

The Filter property conta<strong>in</strong>s a list of the file types from which the user can choose. The file<br />

types are displayed <strong>in</strong> the File of type: combo box <strong>in</strong> the file dialog box. You can set Filter<br />

to reflect types of files specific to your application. For <strong>in</strong>stance, a simple text-edit<strong>in</strong>g program<br />

could have the filter set to show files of type TXT, INI, and LOG, to name just a few. The filter<br />

can easily be set at design time through the Filter Editor dialog box. To <strong>in</strong>voke the Filter<br />

Editor, double-click the Value column next to the Filter property <strong>in</strong> the Object Inspector.<br />

Figure 8.9 shows the Filter Editor for a File Open dialog box, as described previously.<br />

Figure 8.9.<br />

The Filter Editor<br />

dialog box.<br />

The Filter Name column conta<strong>in</strong>s a textual description of the file type. The Filter column<br />

is the actual file mask that will be used to display files of that type.<br />

Although you can enter the filter str<strong>in</strong>g directly <strong>in</strong> the Value column of the Object Inspector,<br />

it is easiest to use the Filter Editor. If you are only us<strong>in</strong>g a s<strong>in</strong>gle filter, you can type it directly<br />

<strong>in</strong>to the Value column for the Filter property. Separate the description and filter with a pipe.<br />

For <strong>in</strong>stance, to have a s<strong>in</strong>gle filter for all file types, you would enter the follow<strong>in</strong>g:<br />

All Files (*.*)|*.*<br />

The FilterIndex Property<br />

The FilterIndex property is used to set the filter that will be used when the dialog box is<br />

<strong>in</strong>itially displayed. The <strong>in</strong>dex is not zero based as you might expect, however. The first filter<br />

<strong>in</strong> the list is 1, the second is 2, and so on. For example, refer to Figure 8.9. If you wanted the<br />

All Files filter to be the one <strong>in</strong>itially displayed, you would set the FilterIndex property to 4.

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

Saved successfully!

Ooh no, something went wrong!