Handling Control Messages
In the two earlier sections on mouse and keyboard messages, there was no distinction on which messages were available to dialogs or common controls. For each of these, this tutorial will discuss notifications that are available through the callbacks or through subclassing.

Background Information
Before getting into specific control messages, two general information items are worth discussing.

Common Control Messages
Click on the link to jump to the notification information for each control.

Button
Here is the notification information for the MSDN button control. The PowerBASIC controls that are derived from the button common control are button, check3state, checkbox, frame, imgbutton, imgbuttonx, and option.

    MSDN Notifications         Value
    ------------------         -----
    %WM_COMMAND
        %BN_CLICKED		 0
        %BN_DBLCLK		 5
        %BN_DISABLE	   	 4 
        %BN_DOUBLECLICKED   	 5
        %BN_HILITE	   	 2
        %BN_KILLFOCUS	         7
        %BN_PAINT	   	 1
        %BN_PUSHED	  	 
        %BN_SETFOCUS	   	 6
        %BN_UNHILITE	   	 3
        %BN_UNPUSHED	   	

    %WM_NOTIFY
        %BCN_DROPDOWN
        %BCN_HOTITEMCHANGE
        %NM_CUSTOMDRAW      	12

    %WM_CTLCOLORBTN

For %BN_KILLFOCUS and %BN_SETFOCUS to be received, the control style must include %BS_NOTIFY.

Since control callbacks only receive notifications via %WM_COMMAND and %WM_NOFITY, they will not receive the %WM_CTLCOLORBTN notification. A dialog callback, however, can receive %WM_CTLCOLORBTN.

Button Notification Definitions (from MSDN)

Combobox
Here is the notification information for the MSDN combobox control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_COMMAND
        %CBN_CLOSEUP	
        %CBN_DBLCLK	
        %CBN_DROPDOWN	
        %CBN_EDITCHANGE	
        %CBN_EDITUPDATE	
        %CBN_ERRSPACE	
        %CBN_KILLFOCUS	
        %CBN_SELCHANGE	
        %CBN_SELENDCANCEL
        %CBN_SELENDOK	
        %CBN_SETFOCUS	

    %WM_COMPAREITEM	
    %WM_DRAWITEM	
    %WM_MEASUREITEM	

Since control callbacks only receive notifications via %WM_COMMAND and %WM_NOTIFY, they will not receive the %WM_COMPAREITEM, %WM_DRAWITEM, and %WM_MEASUREITEM messages. A dialog callback, however, can receive them.

Combobox Notification Definitions (from MSDN)

Static Control
Here is the notification information for the MSDN static control. The PowerBASIC controls that are derived from the static common control are graphic, image, imagex, label and line.

    MSDN Notifications         Value
    ------------------         -----
    %WM_COMMAND
	STN_CLICKED
        STN_DBLCLK
        STN_DISABLE
        STN_ENABLE

    WM_CTLCOLORSTATIC

Static Control Notification Definitions (from MSDN)

ListBox
Here is the notification information for the MSDN listbox control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_COMMAND
        LBN_DBLCLK
        LBN_ERRSPACE
        LBN_KILLFOCUS
        LBN_SELCANCEL
        LBN_SELCHANGE
        LBN_SETFOCUS

    WM_CHARTOITEM
    WM_CTLCOLORLISTBOX
    WM_DELETEITEM
    WM_VKEYTOITEM

For %LBN_DBLCLK to be received, the control style must include %LBS_NOTIFY.

Since control callbacks only receive notifications via %WM_COMMAND and %WM_NOTIFY, they will not receive the WM_CHARTOITEM, WM_CTLCOLORLISTBOX, WM_DELETEITEM or WM_VKEYTOITEM messages. A dialog callback, however, can receive them.

ListBox Notification Definitions (from MSDN)

ListView
Here is the notification information for the MSDN listview control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_NOTIFY
        LVN_DELETEITEM	
        LVN_ENDLABELEDIT
        LVN_ENDSCROLL	
        LVN_GETDISPINFO	
        LVN_GETEMPTYMARKUP	
        LVN_GETINFOTIP
        LVN_HOTTRACK
        LVN_INCREMENTALSEARCH
        LVN_INSERTITEM
        LVN_ITEMACTIVATE
        LVN_ITEMCHANGED
        LVN_ITEMCHANGING
        LVN_KEYDOWN
        LVN_LINKCLICK
        LVN_MARQUEEBEGIN
        LVN_ODCACHEHINT
        LVN_ODFINDITEM
        LVN_ODSTATECHANGED
        LVN_SETDISPINFO
        NM_CLICK
        NM_CUSTOMDRAW
        NM_DBLCLK
        NM_HOVER
        NM_KILLFOCUS
        NM_RCLICK
        NM_RDBLCLK
        NM_RELEASEDCAPTURE
        NM_RETURN
        NM_SETFOCUS

ListView Notification Definitions (from MSDN)

Progress Bar
There are no notifications for the MSDN progress bar control.

Scroll Bar
Here is the notification information for the MSDN scroll bar control. There are no %WM_COMMAND or %WM_NOTIFY notifications for a scroll bar.

    MSDN Notifications         Value
    ------------------         -----
    %WM_CTLCOLORSCROLLBAR
    %WM_HSCROLL
    %WM_VSCROLL

Since control callbacks only receive notifications via %WM_COMMAND and %WM_NOTIFY, they will not receive the %WM_CTLCOLORSCROLLBAR, %WM_HSCROLL, or %WM_SCROLL messages. A dialog callback, however, can receive them.

Scroll Bar Notification Definitions (from MSDN)

Status Bar
Here is the notification information for the MSDN status bar control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_NOTIFY
        %NM_CLICK
        %NM_DBLCLK
        %NM_RCLICK
        %NM_RDBLCLK
        5SBN_SIMPLEMODECHANGE

Status Bar Notification Definitions (from MSDN)

TAB
Here is the notification information for the MSDN tab control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_NOTIFY
        %NM_CLICK
        %NM_DBLCLK
        %NM_RCLICK
        %NM_RDBLCLK
        %NM_RELEASEDCAPTURE
        %TCN_FOCUSCHANGE
        %TCN_GETOBJECT
        %TCN_KEYDOWN
        %TCN_SELCHANGE
        %TCN_SELCHANGING

TextBox Notification Definitions (from MSDN)

TextBox
Here is the notification information for the MSDN textbox control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_COMMAND
        %EN_ALIGN_LTR_EC
        %EN_ALIGN_RTL_EC
        %EN_CHANGE
        %EN_ERRSPACE
        %EN_HSCROLL
        %EN_KILLFOCUS
        %EN_MAXTEXT
        %EN_SETFOCUS
        %EN_UPDATE
        %EN_VSCROLL

    %WM_CTLCOLOREDIT
Since control callbacks only receive notifications via %WM_COMMAND and %WM_NOTIFY, they will not receive the %WM_CTLCOLOREDIT message. A dialog callback, however, can receive it.

TextBox Notification Definitions (from MSDN)

Toolbar
Here is the notification information for the MSDN toolbar control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_NOTIFY
        %NM_CHAR
        %NM_CLICK
        %NM_CUSTOMDRAW
        %NM_DBLCLK
        %NM_KEYDOWN
        %NM_LDOWN
        %NM_RCLICK
        %NM_RDBLCLK
        %NM_RELEASEDCAPTURE
        %NM_TOOLTIPSCREATED
        %TBN_BEGINADJUST
        %TBN_BEGINDRAG
        %TBN_CUSTHELP
        %TBN_DELETINGBUTTON
        %TBN_DRAGOUT
        %TBN_DRAGOVER
        %TBN_DROPDOWN
        %TBN_DUPACCELERATOR
        %TBN_ENDADJUST
        %TBN_ENDDRAG
        %TBN_GETBUTTONINFO
        %TBN_GETDISPINFO
        %TBN_GETINFOTIP
        %TBN_GETOBJECT
        %TBN_HOTITEMCHANGE
        %TBN_INITCUSTOMIZE
        %TBN_MAPACCELERATOR
        %TBN_QUERYDELETE
        %TBN_QUERYINSERT
        %TBN_RESET
        %TBN_RESTORE
        %TBN_SAVE
        %TBN_TOOLBARCHANGE
        %TBN_WRAPACCELERATOR
        %TBN_WRAPHOTITEM

Toolbar Notification Definitions (from MSDN)

TreeView
Here is the notification information for the MSDN treeview control.

    MSDN Notifications         Value
    ------------------         -----
    %WM_NOTIFY
        %NM_CLICK
        %NM_CUSTOMDRAW
        %NM_DBLCLK
        %NM_KILLFOCUS
        %NM_RCLICK
        %NM_RDBLCLK
        %NM_RETURN
        %NM_SETCURSOR
        %NM_SETFOCUS
        %TVN_ASYNCDRAW
        %TVN_BEGINDRAG
        %TVN_BEGINLABELEDIT
        %TVN_BEGINRDRAG
        %TVN_DELETEITEM
        %TVN_ENDLABELEDIT
        %TVN_GETDISPINFO
        %TVN_GETINFOTIP
        %TVN_ITEMCHANGED
        %TVN_ITEMCHANGING
        %TVN_ITEMEXPANDED
        %TVN_ITEMEXPANDING
        %TVN_KEYDOWN
        %TVN_SELCHANGED
        %TVN_SELCHANGING
        %TVN_SETDISPINFO
        %TVN_SINGLEEXPAND

TreeView Notification Definitions (from MSDN)

If you have any suggestions or corrections, please let me know.