# Delete Control
> [HTML Version](delete_control.htm)
_Updated February 2014_
CTLOP\_DEL (opcode 3) is used to delete a control or set of controls. Typically you only need to specify the _ctlid_, e.g.
xcall AUI, AUI\_CONTROL, CTLOP\_DEL, CTLID
As a special convenience, you can delete the current dialog without even knowing its id by specifying a _ctlid _of 0 and putting MBF\_DIALOG in the _ctype_ field:
CTLID = 0
xcall AUI, AUI\_CONTROL, CTLOP\_DEL, CTLID, NUL\_CTEXT\$, NUL\_CSTATE, MBF\_DIALOG
You have to specify the _ctext _and _cstate _parameters prior to the _ctype _parameter, but since we don't care about them, we use the symbols NUL\_CTEXT\$ and NUL\_CSTATE, defined in [ashell.def](ashell_def.htm.md) as "" and 0, respectively, as placeholders.
The other way to delete controls is by setting _ctext _to "\*" and using the _srow_, _scol_, _erow_, and _ecol _parameters to specify a region. In this case it is essential to specify the _parentid _(typically a dialog) unless referencing controls directly in the main window. _ctlid_ should be set to 0. For example, to delete all of the controls within the region bounded by 1,1 and 3,30 within the dialog whose id is "dlgOne":
CTLID = 0 : DLGID = "dlgOne" : srow = 1 : scol = 1 : erow = 3 : ecol = 30
xcall AUI, AUI\_CONTROL, CTLOP\_DEL, CTLID, "\*", cstate, ctype, cmd, func, cstatus, srow, scol, erow, ecol, NUL\_FGC, NUL\_BGC, NUL\_FONTATTR, NUL\_FONTSCALE, NUL\_FONTFACE\$, NUL\_TOOLTIP\$, DLGID
As mentioned above, the various NUL\_xxx symbols are defined in [ashell.def](ashell_def.htm.md) as 0 or "", and are used here for clarity as placeholders for the "don't care" parameters.
A third way to delete controls is with TAB(-1,0), which deletes everything, including dialogs, unless the MX\_AUTOPARENT is set, in which case the action is confined to the children of the specified parent.
To delete all the controls but leave untouched the plain text in the main window, specify ctlid 0 without any other parameters:
xcall AUI, AUI\_CONTROL, CTLOP\_DEL, 0
**Comments**
Deleting a control will automatically delete any child controls of that control.If you want to delete just the children but leave the target control alone, you can use _opcode_ 4 (see [Clear Control](clear_control.htm.md)) or by specifying the _parentid_ with all of the other parameters set to null, e.g.:
xcall AUI, AUI\_CONTROL, CTLOP\_DEL, NUL\_CTLID, NUL\_CTEXT\$, NUL\_CSTATE, NUL\_CTYPE, NUL\_CMD\$, NUL\_FUNC\$, NUL\_CSTATUS, NUL\_SROW, NUL\_SCOL, NUL\_EROW, NUL\_ECOL, NUL\_FGC, NUL\_BGC, NUL\_FONTATTR, NULL\_FONTSCALE, NUL\_FONTFACE\$, NUL\_TOOLTIP\$, parentid
**History**
2014 February, A-Shell 6.1.1377: Several improvements and doc modifications.
2012 October, A-Shell 6.0.1261: Support _ctlid_=0 to clear all of the controls, leaving plain text alone:
xcall AUI, AUI\_CONTROL, CTLOP\_DEL, 0