Subroutines > Detailed Descriptions > AUI > Control > AUI_Control Parameters > opcode

Clear Control

CTLOP_CLR (opcode 4) is just like opcode 3, except for the following differences:

• If ctlid is specified, then only the children of that control are deleted. This is most useful with Tab controls, where, as you change panes, you need to remove the children previously displayed on the old pane and create the ones corresponding to the new one. If ctlid does not refer to a control with children, then it is ignored (i.e. treated as if zero), in which case it identifies the controls to be deleted by the coordinates (assuming ctext = “*”). See XTREE/XTEXT Tab Performance for an alternative to clearing and recreating XTREE and XTEXT controls within Tab panes.

• It only deletes "unprotected" controls.  By default static text controls are unprotected (as are those created with EPRINT), while most other types are protected. (You can, however, remove protection from protected controls by adding MBF_UNPROTECTED when the control is created.) To add protection to text controls, you have to add the dim attribute and also enable protection just like you would with regular text, using Tab(-1,13). For text controls created with AUI, AUI_CONTROL, you add protection by specifying MBF_DIM when creating the control. For text controls created via TPRINT commands, the MBF_DIM attribute is set automatically if the current text mode is dim (i.e., if Tab(-1,11) was issued previously.) The point of all this is to allow you to perform the same “trick” that is possible with dumb terminals, whereby you can protect the background of a form and clear the foreground with just a couple of commands. If it just seems confusing, you can probably ignore it.

PRINT TAB(-1,10) (clear to end of screen) and PRINT TAB(-1,9) internally perform an opcode 4 for the region in question.