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.

288 Day 8<br />

NOTE<br />

The Edit component encapsulates the basic s<strong>in</strong>gle-l<strong>in</strong>e edit control. This component has no<br />

Align or Alignment property. It has no Alignment property because the text <strong>in</strong> a s<strong>in</strong>gle-l<strong>in</strong>e<br />

edit control can only be left-justified. The Edit component has no Align property because<br />

it cannot (or more accurately, should not) be expanded to fill the client area of a w<strong>in</strong>dow.<br />

TIP<br />

If you need text <strong>in</strong> an edit component to be right-justified or centered,<br />

use a Memo component but make its height the height of a standard Edit<br />

component. Then set the Alignment property as needed.<br />

Keep your forms standard whenever possible. Although you can make<br />

an Edit component as tall as you like, it will confuse users if you make<br />

its height greater than a standard W<strong>in</strong>dows edit control (it might<br />

appear to the user to be a multil<strong>in</strong>e edit).<br />

The MaskEdit component is an Edit component with an <strong>in</strong>put filter, or mask, attached. The<br />

MaskEdit does not represent a W<strong>in</strong>dows control per se, but rather is just a VCL extension of<br />

a standard edit control. A mask is used to force <strong>in</strong>put to a specific range of numbers or<br />

characters. In addition, the mask can conta<strong>in</strong> special characters that are placed <strong>in</strong> the edit<br />

control by default. For example, a date is commonly formatted as follows:<br />

10/25/97<br />

An edit mask for a date can already have the slashes <strong>in</strong> place so that the user only has to enter<br />

the numbers. The edit mask would specify that only numbers can be entered to avoid the<br />

possibility of the user enter<strong>in</strong>g a nonnumeric character.<br />

The EditMask property controls the mask used. When you press the ellipsis (…) button <strong>in</strong><br />

the Value column for the EditMask property, the Input Mask Editor is displayed. This dialog<br />

box allows you to choose one of the predef<strong>in</strong>ed masks or to create your own. You can choose<br />

prebuilt masks from several countries. Figure 8.3 shows the Input Mask Editor display<strong>in</strong>g the<br />

United K<strong>in</strong>gdom set of predef<strong>in</strong>ed <strong>in</strong>put masks.<br />

For more <strong>in</strong>formation on build<strong>in</strong>g your own masks, see the <strong>C++</strong>Builder onl<strong>in</strong>e help.<br />

The Memo component encapsulates a multil<strong>in</strong>e edit control. The L<strong>in</strong>es property is the most<br />

significant property <strong>in</strong> a Memo component. As mentioned earlier <strong>in</strong> the discussion on<br />

TStr<strong>in</strong>gs, the L<strong>in</strong>es property allows you to save the contents of the Memo component to disk

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

Saved successfully!

Ooh no, something went wrong!