# Add Control > [HTML Version](addcontrol.htm) _Rewritten Feburary 2013_ To add or create a control, use CTLOP\_ADD and specify at least all the parameters up through the _ecol _parameter. The rest are optional. The following simple example creates a button occupying the rectangle from 5,10 to 6,20 (in the grid units of the current parent window), displaying "Process", and transmitting exitcode -107 when clicked: xcall AUI, AUI\_CONTROL, CTLOP\_ADD, ctlid, "Process", MBST\_ENABLE, MBF\_BUTTON + MBF\_KBD, "VK\_xF107", "", cstatus, 5, 10, 6, 20 In this slightly more complex example, we create a clickable static text control, specifying an alphanumeric id and a variety of other attributes. See _Comments_. fontattr = FS\_ITALIC + FA\_HEAVY fontscale = 250 fontface\$ = "Impact" tooltip\$ = "Click for more information" parentid\$ = "gbMessages" xcall AUI, AUI\_CONTROL, CTLOP\_ADD, "txtWarning", "Warning\! Meltdown Imminent\!", MBST\_ENABLE, MBF\_STATIC + MBF\_LFJUST + MBF\_AUTOGROW + MBF\_KBD, "VK\_xF108", NUL\_FUNC\$, NUL\_CSTATUS, 2, 10, 3, 20, \&h0000ff, RGB\_TRANSPARENT, fontattr, fontscale, fontface\$, tooltip\$, parentid\$ **Comments** • If the _ctlid_ parameter is numeric, it is ignored on input and set to the new control's numeric id on output. But if _ctlid _is alphanumeric, it is used as-is, and does not change. The numeric equivalent (or an error code < 0) will be returned in the _cstatus_ parameter, assuming the parameter is numeric. The second example uses NUL\_CSTATUS, defined as "" in [ashell.def](ashell_def.htm.md), which eliminates the return status; this is a significant performance optimization in the case of ATE where each control created would otherwise require waiting for the client's return status packet to arrive before the next control could be created. • If the _parentid_ parameter is not specified, as in the first example, the new control will be a child of the current window: either a modal dialog, if one exists, or else the main window. The coordinates specified will be taken as relative to the parent control. • For most child controls, if the new control has the same starting position as an existing child control, the existing control will be removed. In the case of the [GUI\_SPC\_IND](gui_spc_ind.htm.md) system option, this rule is expanded slightly to allow a new control to replace a pre-existing one that overlaps the new one. In both cases, the intent is to simplify automated strategies for migrating from plain text to GUI. See [AUTOTPRINT](autotprintopt.htm.md), [MX\_DEFTABXYZ](mx_deftabxyz.htm.md), and INFLD's _type _**|G**). • Normally, the control type is determined by the _ctype _parameter, but in certain circumstances you can set _ctype _to 0 and specify the control type in the _winclass_, _winstyle_, and _winstylex _parameters. This technique is generally only useful for control types that do not require any interactivity -besides a click action), with the main example being [Lines, Rectangles and Frames](linesrectanglesandframes.htm.md), although it may also provide a way to create a control type for which no _ctype _flags have been defined.