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.

NOTE<br />

VCL Components<br />

To set the glyph for a BitBtn, double-click the Value column <strong>in</strong> the Object Inspector next<br />

to the Glyph property. The Image Editor will be displayed, and you can choose the bitmap<br />

that will be used for the glyph.<br />

The standard button glyphs that come with <strong>C++</strong>Builder are 15×15<br />

pixels <strong>in</strong> size. This size fits well with the standard button height of 25<br />

pixels. Your glyphs can be any size you like, but the BitBtn component<br />

makes no effort to size the button accord<strong>in</strong>g to the size of the bitmap.<br />

If you use larger glyphs, you will have to size the button accord<strong>in</strong>gly.<br />

The K<strong>in</strong>d Property<br />

The K<strong>in</strong>d property is a nice feature of the BitBtn component that allows you to choose from<br />

several predef<strong>in</strong>ed k<strong>in</strong>ds of buttons. The default value for the K<strong>in</strong>d property is bkCustom,<br />

which means that you will supply the glyph and set any other properties for the button.<br />

Choos<strong>in</strong>g any of the other predef<strong>in</strong>ed k<strong>in</strong>ds will result <strong>in</strong> these five th<strong>in</strong>gs happen<strong>in</strong>g:<br />

■ The Glyph property is automatically set for the k<strong>in</strong>d of button chosen.<br />

■ The Cancel or Default properties are modified accord<strong>in</strong>g to the k<strong>in</strong>d of button<br />

chosen.<br />

■ The Caption property is modified for the type of button chosen.<br />

■ The ModalResult property is set accord<strong>in</strong>g to the k<strong>in</strong>d of button chosen.<br />

■ The button on the form is updated to reflect all these sett<strong>in</strong>gs.<br />

For <strong>in</strong>stance, if you set the value of K<strong>in</strong>d to bkOK, the button will become an OK button. The<br />

glyph is set to a green check mark, the Cancel property is set to false, the Default property<br />

is set to true, the ModalResult property is set to mrOk, the Caption property is set to OK, and<br />

the results show up on the form. You can always override any of the properties modified by<br />

chang<strong>in</strong>g the K<strong>in</strong>d property, but it is not usually necessary to do so. Figure 8.6 shows the<br />

Button Test program from http://www.mcp.com/sams/codecenter.html, with the BitBtn<br />

Test form displayed. The form conta<strong>in</strong>s each of the predef<strong>in</strong>ed button types available plus<br />

one custom button.<br />

The Layout Property<br />

The Layout property determ<strong>in</strong>es where the button is placed relative to the text. The default<br />

is blGlyphLeft. You can also choose to place the glyph on the face of the button to the right<br />

of the text, above the text, or below the text.<br />

301<br />

8

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

Saved successfully!

Ooh no, something went wrong!