Delete Control

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 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 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) 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