The connectStaticNotify connects a notification message from a static control to a method, defined by the programmer, of the dialog. Normally, static controls do not send notification messages. A static control will only send the messages when it has the SS_NOTIFY style. The notification messages inform the dialog that an event has occurred with regard to the static control.

For user defined dialogs use the NOTIFY style keyword in the Add... static control methods when the control is defined. For dialogs created from a compiled resource or a resource script file use the SS_NOTIFY style when defining the control in a resource editor.


The arguments are:


The resource ID of the static control.


A keyword specifying the event to be connected with a method:


The static control has been clicked with the mouse.


The static control has been double-clicked with the mouse.


The static control has been disabled.


The static control has been enabled.


The method that is to be invoked whenever the specified notification is received from the static control. The programmer defines this method. If this argument is omitted, a method name is automatically generated that consists of the event keyword preceded by on. For instance, onClick.

Return value:

The return codes are:


No error detected.


The resource ID could not be resolved or the event argument is incorrect.


The message was not connected correctly.

Additional Notes:

  1. The invocation of connectStaticNotify() can be placed in the init or initDialog method. (Indeed the invocation can be done anywhere. But, it makes most sense to have the connection made before the dialog starts executing.) If the connection is made in the init() method, be sure that the super class init() is invoked first.

  2. The defined event-handling methods will receive two arguments. The first arg contains information about the specific control and its event. The second arg is the window handle of the static control.

    The low word of the first arg is the control ID and the high word is the event ID.


The following example comes from an application that displays employee statistics. A single click on the employee number field advances the display to the next employee. A double click on either the employee name or employee job duties alllows those fields to be edited.

::method initDialog

  self~connectStaticNotify(IDC_ST_EMPNO, "CLICK", empLookup)

  self~connectStaticNotify(IDC_ST_EMPJOB, "DBLCLK", editStats)
  self~connectStaticNotify(IDC_ST_EMPNAME, "DBLCLK", editStats)

  first = self~initDatabase

In this example, (a continuation of the above example,) the control ID determines if the user has double clicked on the employee job duties field, or the employee name field. The event ID is not used, or needed. Its purpose in the code snippet is simply an example. The same thing applies to the window handle.

::method editStats
  use arg ctrlInfo, ctrlHwnd

  ctrlID = .DlgUtil~loWord(ctrlInfo)
  eventID = .DlgUtil~hiWord(ctrlInfo)

  rec = self~getCurrentRecord

  if self~userUpdate(ctrlID, rec) then self~setStats(rec)