The bedit Control

The bedit (boxed edit) control is a variation of the hedit control. All characteristics of an hedit control described in the preceding section also apply to the bedit control, with two exceptions:

  • A bedit window displays writing guides in which the user must write. Interpreted text returned from the recognizer replaces the handwritten characters within the guides.

  • A bedit control does not support edit control styles ES_READONLY, ES_CENTER, ES_LEFT, and ES_RIGHT. (Text in a bedit is left aligned.)

An application can specify guides either as a comb or as a set of boxes, as shown in Figure 3.1. The comb consists of a horizontal line with spaced tick marks. The user writes individual characters between the marks.

These visual guides can greatly improve recognition because they remove from the recognizer the significant burden of correctly segmenting the text into separate characters. For example, consider Figure 3.2, which shows a word written in an hedit control.

In this case, the recognizer would probably have difficulty choosing between the words "clean" and "dean" because of the narrow spacing between the first two strokes. The bedit control removes such ambiguities. By writing within the guides of a bedit control, the user implicitly informs the recognizer what strokes compose a single character.

For a description of how the bedit control has been improved in Windows 95, see Appendix A, "Differences Between Versions 1.0 and 2.0 of the Pen Application Programming Interface."

Windows treats characters in a bedit control as a continuous stream of text. If the control contains more than one row, text wraps at each row end without regard to word boundaries. The EM_SETWORDBREAK message has no effect on a boxed edit control.

An application creates a bedit control with the Windows CreateWindow function, specifying a window class of BEDIT. The following code shows how to create a multiline bedit control:

hwndBedit = CreateWindow( "BEDIT", NULL,




hwndParent, CHILD_ID, hinstCurrent, NULL );

The BOXLAYOUT structure governs the height and style of the box grid within the bedit control. Its style member accepts one of the following BXS_ values:

Resets current box style to the default comb style.
Specifies a grid of closed rectangular boxes.
Specifies small crosses at the center of each box. This is used mainly to aid recognition of certain Far Eastern languages.

To set box height and style, fill a BOXLAYOUT structure with the desired values and pass it as a submessage of WM_PENCTL, as shown here:

BOXLAYOUT boxlayout;




boxlayout.cyCusp = 6; // Box sides are 6 pixels high

boxlayout.cyEndCusp = 6; // Ends should be the same = BXS_RECT; // Grid of closed boxes

iRet = SendMessage( hwndHedit, WM_PENCTL, HE_SETBOXLAYOUT,

(LONG)((LPBOXLAYOUT) &boxlayout) );

Refer to Chapter 11, "Pen Application Programming Interface Structures," for a more detailed description of the BOXLAYOUT structure. The next section explains how to set the system assumptions about the appearance of a bedit control.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples