t_control

typedef struct t_control {             // Descriptor of dialog control
  ulong          type;                 // Type of control, CA_xxx
  int            id;                   // Control's ID or -1 if unimportant
  int            x;                    // X coordinate, chars/4
  int            y;                    // Y coordinate, chars/8
  int            dx;                   // X size, chars/4
  int            dy;                   // Y size, chars/8
  int            *var;                 // Pointer to control variable or NULL
  wchar_t        *text;                // Name or contents of the control
  wchar_t        *help;                // Tooltip or NULL
  int            oldvar;               // Copy of control variable, internal
} t_control;

Descriptor of control (child window) in OllyTest dialogs and plugin options. The complete dialog or pane is an array of the structures of type t_control. The last (pseudo)control in the array must have type CA_END.


Members:

type
Type of the control, one of the constants CA_xxx. See table below for detailed description
id
Identifier of the control, positive integer in the range 1..16383. Inside the Plugin options dialog, use only predefined identifiers OPT_xxx (OPT_TITLE, OPT_1..OPT_24 etc.) Each identificator within the dialog or pane must be unique. The only exception: if control is unimportant, like unmodifiable text label, it can be set to -1
x
X coordinate of the top left corner of the control, measured in the dialog units, within the dialog's client area. One horizontal dialog unit is approximately 1/4 of the mean character width
y
Y coordinate of the top left corner of the control, measured in the dialog units, within the dialog's client area. One vertical dialog unit is approximately 1/8 of the mean character height
dx
Width of the control, dialog units. Note that some controls, like static text or checkboxes, ignore this setting and determine necessary width from the width of the text. To force control to the specified width, negate dx
dy
Height of the control, dialog units
var
Pointer to the variable associated with the control, or NULL if automatic update is not necessary or control does not support it. Checkboxes, radio buttons, list boxes and combo boxes without edit use var to set their initial state and change it whenever selection or state of control is changed
text
UNICODE text associated with the control. For edit controls, this is also the buffer that receives text modified by user. Required length of the buffer depends on type. For combo boxes, text is a list of strings separated by vertical line ('|') that are used to initialize list
help
UNICODE string, tooltip associated with the control, or NULL if tooltip is not required
oldvar
Used internally by OllyDbg, buffer that keeps old value of var


Supported types of controls

Type Description Auto width
CA_COMMENT Dummy entry without the corresponding child window, ignored in the custom dialogs. In the plugin options, defines text that identifies options page in the page selection list  No
CA_TEXT Simple left-aligned text Yes
CA_TEXTC Simple centered text No
CA_TEXTR Simple right-aligned text No
CA_WARN Multiline text, highlighted when user changes plugin option with identifiers OPT_W1 .. OPT_W12, or when user turns on option with identifiers OPT_S1 .. OPT_S12, or when all options with identifiers OPT_X1 .. OPT_X12 are turned on. At most one control of type CA_WARN per dialog or options page is allowed No
CA_WTEXT Text with white background in sunken frame No
CA_TITLE Bold centered text of increased size No
CA_FRAME Etched frame. It must be defined after all controls that are placed inside the frame No
CA_SUNK Sunken frame. It must be defined after all controls that are placed inside the frame No
CA_GROUP Group box (named frame). It must be defined after all controls that are placed inside the frame No
CA_EDIT Standard edit control. Length of the buffer pointed to by text must be at least TEXTLEN wide characters. This buffer is used to initialize control and receives edited text on exit from the dialog  No
CA_NOEDIT Read-only edit control that does not allow to edit displayed text No
CA_EDITHEX Edit control that accepts only hexadecimal digits and displays them in uppercase. Length of the buffer pointed to by text must be at least TEXTLEN wide characters. This buffer is used to initialize control and receives edited text on exit from the dialog   No
CA_MULTI Multiline edit control that also accepts return key. Length of the buffer pointed to by text must be at least DATALEN wide characters. This buffer is used to initialize control and receives edited text on exit from the dialog No
CA_NOMULTI Multiline read-only edit control No
CA_BTN Standard pushbutton, requires custom processing No
CA_DEFBTN Standard default pushbutton, requires custom processing No
CA_COMBO Combo box control. text points to the list of items separated by a vertical line ('|'). var is the index of the item that will be initially selected. When user changes selection, OllyDbg updates var No
CA_COMBOFIX Combo box control, fixed-pitch font. text points to the list of items separated by a vertical line ('|'). var is the index of the item that will be initially selected. When user changes selection, OllyDbg updates var No
CA_CEDIT Combo box with edit control, requires custom processing No
CA_CEDITFIX Combo box with edit control (fixed-pitch font), requires custom processing No
CA_LIST Simple list box. text points to the list of items separated by a vertical line ('|'). var is the index of the item that will be initially selected. When user changes selection, OllyDbg updates var No
CA_LISTFIX Simple list box (fixed-pitch font). text points to the list of items separated by a vertical line ('|'). var is the index of the item that will be initially selected. When user changes selection, OllyDbg updates var No
CA_CHECK Left-aligned auto check box. var specifies initial state of the control. When user changes state, OllyDbg updates var Yes
CA_CHECKR Right-aligned auto check box. var specifies initial state of the control. When user changes state, OllyDbg updates var Yes
CA_BIT0..
CA_BIT31
Left-aligned auto check boxes. var specifies initial state of the controls, namely: CA_BIT0 is checked when bit 0 (LSB) is 1, CA_BIT1 - when bit 1 is set, and so on. When user changes state of the control, OllyDbg updates var Yes
CA_RADIO0..
CA_RADIO15
Left-aligned radio buttons. Dialog may contain several groups of radio buttons. Item CA_RADIO0 starts new group. Buttons belonging to the same group must be defined in the consecutive records and have consecutive identifiers (but not necessarily consecutive types: for example, CA_RADIO0 may be followed by CA_RADIO8). var determines initial state of the group. If var is 0, OllyDbg selects CA_RADIO0, if var is 1 - CA_RADIO1 and so on. When user clicks some radio button, OllyDbg updates var Yes
CA_END Dummy entry without the corresponding child window, must be the last record in the dialog descriptor. Stops dialog processing. In the custom dialogs, dx and dy define size of the client area (note: client area of the dialog, not the overall size of the dialog window!), text specifies default title. In the plugin options page all parameters are ignored No

Note that var in the table above means the variable pointed to by var or the contents of this variable.


Example:

See here.


See also:
Dialogs, t_dialog, Defaultactions(), Findcontrol(), ODBG2_Pluginoptions(), Preparedialog()