StaticText
StaticText is a text label. This would be used for labeling the screen in places other than user-editable fields. Most other window subclasses provide their own screen labels.
Window Structure Details
- int x,y,w,h:
x and y give the coordinates (x,y) to start displaying the text.
- PLHRES Title:
Title defines the label to be displayed to the left of the StaticText. StaticText only supports single-line labels.
- PLHDATA Data:
Data points to the text buffer which will be appended to the title string before the window is drawn. This allows a StaticText window to have a static resource portion and a dynamic variable portion. An example of this would be in the File..Open dialog box where the Directory: C:\TEMP\ text window displays both static and dynamic strings. If this field is NULL, no string will be appended to the window title.
- UINT LogicalSize:
LogicalSize indicates the maximum size, in characters, of the text buffer pointed to by the Data field.
- UINT Style:
Style bits associated with DrawText can be used here, including DRAW_INVERT, DRAW_UNDERLINE, DRAW_GRAY, DRAW_TAB_TERM and DRAW_AMPERSAND. For a complete definition of these, see the LHAPI function DrawText().
Style bits specific to the StaticText dialog are TEXT_CENTER and TEXT_RIGHT which control justification of the text within the window.
- PLHWINDOW Parent: Used by the Object class handler.
- PLHFKEYS FKeys: Used by the Object class handler.
- PLHMENU Menu: Used by the Object class handler.
- UINT Selection: Not used.
- UINT WindowTop: Not used.
Messages
- DRAW:
The StaticText handler draws the text string pointed to by the Title field, then draws the string pointed to by the Data field. StaticText draws a blank rectangle following the displayed strings to the end of the window, as defined by the w field. This prevents any previous part of the Data field string from remaining on the screen when changes are made to it.
- CREATE:
StaticText sets the style bits STYLE_NOFOCUS and STYLE_LEAF.
- APPEAR:
If STYLE_WHCHAR is being used, the StaticText handler converts the size of the StaticText window (w,h) from the specified text character size to the corresponding display unit size.
- DISAPPEAR:
If STYLE_WHCHAR is being used, the StaticText handler convertsthe size of the StaticText window (w,h) back from the previously calculated display unit size to the original text character size.
- KEYSTROKE: Passed to the Object class handler.
- SETFOCUS: Passed to the Object class handler.
- LOSEFOCUS: Passed to the Object class handler.
- NULLEVENT: Passed to the Object class handler.
- DESTROY: Passed to the Object class handler.
- TERMINATE: Passed to the Object class handler.
- ACTIVATE: Passed to the Object class handler.
- DEACTIVATE: Passed to the Object class handler.
- NOTIFY: Passed to the Object class handler.
- COMMAND: Passed to the Object class handler.