The ConnectTabNotify method connects a particular WM_NOTIFY message for a tab control with a method. The WM_NOTIFY message informs the dialog that an event has occurred with regard to the tab control.


The arguments are:


The ID of the tab control of which a notification is to be connected to a method.


The event to be connected with a method:


A key has been pressed while the tab control was focused.


Another tab has been selected in the tab control. This method is called after the selection was changed.


Another tab has been selected in the tab control. This method is called before the selection is changed.


The message that is to be sent whenever the specified notification is received from the tab control. Provide a method with a matching name. If you omit this argument, the event is preceded by On.

Return value:

The return codes are:


No error detected.


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


The messages was not connected correctly.


The following example invokes method OnSelChange whenever another tab is selected in the tab control PAGE:

::class MyDlgClass subclass UserDialog inherit MessageExtensions

::method Init
  self~ConnectTabNotify("PAGE", "SELCHANGE")


  1. Connections are usually placed in the Init or InitDialog method. If both methods are defined, use init as the place for this connection - but not before init:super has been called.

  2. The event-handling method that is connected to KEYDOWN receives two arguments: the control ID of the tab control and the virtual key code that has been pressed. Use the method KeyName of the VirtualKeyCodes class to get the name of the key. Note that your class must inherit from the VirtualKeyCodes class to use the KeyName method. Example:

    ::method OnKeyDown
      use arg id, vkey
      say "Key" self~KeyName(vkey) "was pressed."

  3. All other event-handling methods receive two arguments: the ID of the tab control (extract the low-order word) and the handle to the tab control. Example:

    ::method Handler
      use arg ev_id, handle
      id = .DlgUtil~loWord(ev_id)