DI_TEXT
The DI_TEXT dialog item describes a static text label.
struct FarDialogItem { int Type = DI_TEXT int X1 = X1 int Y1 = Y int X2 = X2 int Y2 = Y (not used in Dialog API 1.0, must be equal to Y1) int Focus = 0 int Selected = 0 DWORD Flags = Flags int DefaultButton = 0 char Data[512] = text label };
Attention!
- This is an exemplary structure; read full description here.
Flags
There are several flags applicable to the DI_TEXT control:
Flag | Description |
---|---|
DIF_SETCOLOR | The low byte of Flags will be used as the item's color. |
DIF_BOXCOLOR | The text item will be displayed using frame color (COL_DIALOGBOX or COL_WARNDIALOGBOX) |
DIF_CENTERGROUP | Sequential strings with this flag set and equal vertical coordinates will be horizontally centered in the dialog. Their X1 and X2 coordinates are ignored. |
DIF_SEPARATOR | Draws a single-line separator. You may write any text on the separator line, just use Data and the coordinate fields. |
DIF_SEPARATOR2 | Draws a double-line separator. You may write any text on the separator line, just use Data and the coordinate fields. |
DIF_SHOWAMPERSAND | Show ampersand symbol in caption instead of using it for defining hotkeys. |
DIF_CENTERTEXT | Centers the text between the X1 and X2 coordinates. |
Events
Event | Description |
---|---|
DN_DRAWDLGITEM | This event is sent to the dialog callback function just before the text item is drawn. |
DN_CTLCOLORDLGITEM | Plugin should pass the color attributes of the text item when this event comes. Param2 parameter (foreground+background):
LoWord LoByte - color of the text (COL_WARNDIALOGTEXT or COL_DIALOGTEXT). If DIF_BOXCOLOR flag is set: COL_WARNDIALOGBOX or COL_DIALOGBOX LoWord HiByte - color of highlighted text (COL_WARNDIALOGHIGHLIGHTTEXT or COL_DIALOGHIGHLIGHTTEXT) HiWord LoByte - 0 (not used) HiWord HiByte - 0 (not used)If a special attribute is used (DIF_SETCOLOR flag), the text (LoWord LoByte) will be drawn according to the parameters. |
DN_MOUSECLICK | This event comes after the user has clicked one of the dialog items or outside the dialog with the mouse button. |
DN_HOTKEY | Hotkey was pressed (Alt-<letter>). |
Remarks
- It is recommended to set the Y2 coordinate correctly, although it's not used in Dialog API 1.0. Just set it equal to the Y1 coordinate.
- If the DIF_CENTERTEXT flag is set, the X2 field must have adequate value for the correct text centering.
- If the DIF_CENTERTEXT flag is not set, FAR will calculate X2 and Y2 coordinates automatically.
- If this text item is the first in the dialog items array, the text string is copied into the FAR console window title.
- If the text of the DI_TEXT item has a hotkey and DIF_SHOWAMPERSAND flag isn't set, then pressing Alt-Letter causes the keyboard focus to move to the next available dialog item.
See also: