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 />

You can use owner-drawn list boxes if needed. Owner-drawn list boxes are fairly common,<br />

although you may not realize it. On Day 6 I talked about customiz<strong>in</strong>g the <strong>C++</strong>Builder<br />

speedbar. As part of that discussion, we looked at the <strong>C++</strong>Builder Speedbar Editor dialog box,<br />

which was shown <strong>in</strong> Figure 6.2. Go back and take another look at that figure. The Speedbar<br />

Editor dialog box conta<strong>in</strong>s two list boxes. The list box on the left is a regular list box. It lists<br />

the possible button groups you can choose from. The list box on the right is an owner-drawn<br />

list box. It shows the actual button as it will appear on the speedbar, as well as a textual<br />

description of what function the button performs.<br />

Combo boxes are specialized list boxes. Actually, a combo box is a comb<strong>in</strong>ation of a list box<br />

and an edit control. The user can choose from the list or type <strong>in</strong> a value <strong>in</strong> the edit portion.<br />

When the user chooses an item from the list, that item is placed <strong>in</strong> the edit control. There<br />

are three different types of combo boxes. Table 8.5 lists the types of combo boxes and gives<br />

a description of each.<br />

Table 8.5. Types of combo boxes.<br />

Item Description<br />

Simple The simple style of the combo box is noth<strong>in</strong>g more than an edit<br />

control placed on top of a list box. The user can choose from the<br />

list or type text <strong>in</strong> the edit portion.<br />

Drop-down Similar to the simple style, except the list box portion is not<br />

<strong>in</strong>itially displayed. A drop-down button is provided so that the<br />

user can view the list and choose an item. The user can also type<br />

text <strong>in</strong> the edit portion.<br />

Drop-down list This is the most restrictive type of combo box. As with the dropdown<br />

style, the list is not <strong>in</strong>itially exposed. The user can click the<br />

drop-down button to expose the list and choose an item from<br />

the list, but cannot enter text <strong>in</strong> the edit portion. Use this style<br />

when you want the user to select only from a predeterm<strong>in</strong>ed set<br />

of choices.<br />

You can get a program called ComboBox Test from http://www.mcp.com/sams/codecenter.html<br />

that illustrates the different types of combo boxes. Figure 8.4 shows the test program runn<strong>in</strong>g.<br />

Run the program and try out the combo boxes to get a feel for how each works.<br />

Table 8.6 lists the properties common to list boxes and combo boxes.<br />

293<br />

8

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

Saved successfully!

Ooh no, something went wrong!