Purpose |
Remove a control from a dialog. |
Syntax |
CONTROL KILL hDlg, id& |
Remarks |
hDlg refers to the dialog that
owns the control. id& is
the unique control identifier
as assigned to the control with a
The control is destroyed and removed from the dialog. The Callback Function for the control or dialog will no longer receive messages for the control. |
Restrictions |
A control should not be destroyed while processing a notification message from the same control. That is, a control should not "commit suicide", but it is permissible to kill a different control in the notification handler. If a suicide condition is absolutely necessary, use the PostMessage API function (or the DIALOG POST or CONTROL POST statements) to post a user-defined message to the dialog callback, and kill the control when processing the user-defined message. |
See also |
|
Example |
' How to avoid "suicide" conditions CALLBACK FUNCTION DlgCallBack() AS LONG SELECT CASE CB.MSG CASE %WM_COMMAND IF CB.CTLMSG = %BN_GOTFOCUS AND CB.CTL = %MyBtn THEN DIALOG POST CB.HNDL, %WM_USER + 999&, 0, 0 END IF CASE %WM_USER + 999& CONTROL KILL CB.HNDL, %MyBtn FUNCTION = 1 END SELECT END FUNCTION |