[Next] [Previous ] | Chapter17 |
|
Figure 17.1 Entry fields. |
Style | Description |
ES_LEFT | Text is left justified. |
ES_CENTER |
Text is center justified. |
ES_RIGHT |
Text is right justified. |
ES_AUTOSCROLL |
Text is scrolled as the cursor moves beyond the visible portion of the entry field. |
ES_MARGIN |
A margin is drawn around the entry field. |
ES_AUTOTAB |
When the maximum number of characters has been entered, the input focus is passed to the next control with the WS_TABSTOP style. |
ES_READONLY |
Text is not modifiable. |
ES_COMMAND |
The
entry is denoted a command entry field. The help Manager uses this to provide
help for the contents of the field, should the user request it. There should
be only one entry field per window with this style. |
ES_UNREADABLE |
Text is displayed as a string of asterisks ( '*' ), one per character of actual text. |
ES_AUTOSIZE |
The entry field will size itself automatically to insure that the text fits within the visible portion of the control. |
ES_ANY |
The
entry field can contain single- and double-byte characters. If the text is
converted from an ASCII code to an EBCDIC code page, there may be an overrun
in the converted text. Contrast this with ES_MIXED, where this is not allowed. |
ES_SBCS |
Text is comprised of single-byte characters only. |
ES_DBCS |
Text is comprised of double-byte characters only. |
ES_MIXED |
Text
can contain either single- or double-byte characters, which may later be converted
to or from an ASCII code page from or to EDCDIC code page. |
BOOL APIENTRY WinSetWindowText(HWND hwndWindow, PCSZ pszText);hwndWindow is the handle of the entry field to set the text of, and pszText is a pointer to the text. The inconsistency is that, as we will be seen in other controls, text is usually set - and queried - through messages. However, why overcomplicated things unnecessarily ?
LONG APIENTRY WinQueryWindowText(HWND hwndWindow,Again, hwndWindow is the handle of the entry field we are querying. cchBufferMax specifies the size of the buffer, and pszBuffer points to the receiving buffer. A companion function is helpful here; WinQueryWindowTextLength returns the length of the window text.
LONG cchBufferMax,
PCH pchBuffer);
LONG APIENTRY WinQueryWindowTextLength(HWND hwndWindow);It takes a single parameter - hwndWindow - which indicates the window to be queried.
Gotcha! The limit in the EM_SELECTTEXTLIMIT message should not include the terminating null character, but the extra byte should be allotted when calling WinQueryWindowText and 1 should be added to WinQueryWindowTextLength. An interesting point is that, while there is a message for setting the limit, there is no message for querying the limit. This querying can be accomplished using a voodoo incarnation of the WM_QUERYWINDOWPARAMS message, but that seems to be a lot of work for something so simple. |
ENTRY.C
ENTRY.RC
ENTRY.H
ENTRY.MAK
ENTRY.DEF
[Next] [ Previous ] | Chapter17 |