CBCTL function

Purpose

In a Callback Function, return the numeric ID value of the control sending the callback message.

CBCTL has been superceded by the CB Callback functions, although CBCTL remains supported for a limited period.  Existing code should be converted to the new syntax as soon as possible.

Syntax

Id& = CBCTL

Remarks

When a user clicks on a button, types into a text box, or generally interacts with any control in a dialog, Windows sends a message to the callback for the control (or the dialog if the control does not have a callback).

CBCTL returns the ID number as assigned to the control with the CONTROL ADD statement. CBCTL will return the ID of a control if CBMSG = %WM_COMMAND. For other values of CBMSG, CBCTL will return message-dependent values.

If we consider a conventional callback procedure:

FUNCTION DlgCallback(BYVAL hDlg???, BYVAL wMsg&, BYVAL wParam&, BYVAL lParam&) _

  EXPORT AS LONG

The notification message is sent to the callback as the low-order word of the wParam& parameter. Therefore, CBCTL is functionally equivalent to LO(WORD, wParam&) in a conventional Callback Function, and equivalent to LO(WORD, CBWPARAM) in a DDT Callback Function.

Restrictions

This function is only valid inside a Callback Function.

See also

Dynamic Dialog Tools, CB Callback functions

Example

CALLBACK FUNCTION ComboCallback() AS LONG

  SELECT CASE CBMSG

    CASE %WM_COMMAND

      IF CBCTL = %IDCOMBO AND CBCTLMSG = %CBN_DBLCLK THEN

        CALL UpdateMyStatus()

        FUNCTION = 1

        EXIT FUNCTION

      END IF

    CASE ...

      ...

END FUNCTION