CBCTL function

Purpose

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

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, CBCTLMSG, CBHNDL, CBLPARAM, CBMSG, CBWPARAM

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