john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

win32 edit classes styles

Edit Control Styles

To create an edit control using the CreateWindow or CreateWindowEx function, specify the EDIT class, appropriate window style constants, and a combination of the following edit control styles. After the control has been created, these styles cannot be modified, except as noted.

ES_MULTILINE

Designates a multiline edit control. The default is single-line edit control.

When the multiline edit control is in a dialog box, the default response to pressing the ENTER key is to activate the default button. To use the ENTER key as a carriage return, use the ES_WANTRETURN style.

When the multiline edit control is not in a dialog box and the ES_AUTOVSCROLL style is specified, the edit control shows as many lines as possible and scrolls vertically when the user presses the ENTER key. If you do not specify ES_AUTOVSCROLL, the edit control shows as many lines as possible and beeps if the user presses the ENTER key when no more lines can be displayed.

If you specify the ES_AUTOHSCROLL style, the multiline edit control automatically scrolls horizontally when the caret goes past the right edge of the control. To start a new line, the user must press the ENTER key. If you do not specify ES_AUTOHSCROLL, the control automatically wraps words to the beginning of the next line when necessary. A new line is also started if the user presses the ENTER key. The window size determines the position of the Wordwrap. If the window size changes, the Wordwrapping position changes and the text is redisplayed.

Multiline edit controls can have scroll bars. An edit control with scroll bars processes its own scroll bar messages. Note that edit controls without scroll bars scroll as described in the previous paragraphs and process any scroll messages sent by the parent window.

ES_NUMBER

Allows only digits to be entered into the edit control. Note that, even with this set, it is still possible to paste non-digits into the edit control.

To change this style after the control has been created, use SetWindowLong.

ES_PASSWORD

Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls.

Windows XP: If the edit control is from user32.dll, the default password character is an asterisk. However, if the edit control is from comctl32.dll version 6, the default character is a black circle.

To change the characters that is displayed, or set or clear this style, use the EM_SETPASSWORDCHAR message.

ES_READONLY

Prevents the user from typing or editing text in the edit control.

To change this style after the control has been created, use the EM_SETREADONLY message.

ES_WANTRETURN

Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box's default push button. This style has no effect on a single-line edit control.

To change this style after the control has been created, use SetWindowLong.

  • « win32 styling windows in the UI
  • wince programming »

Published

Feb 6, 2010

Category

c-programming-guides

~506 words

Tags

  • c-programming-guides 25
  • classes 92
  • edit 3
  • styles 1
  • win32 6