SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Notifications can be handled by a tree control's parent window or directly by the tree control itself (in a derived class). WM_COMMAND messages are sent by the control to the parent window. The notification codes used are listed in section "Notifications".
If you want to handle Windows notification messages sent by a tree control to its parent (usually a class derived from CDialog or CView), add a message-map entry and a message-handler member function to the parent class for each notification.
Message-map entries take the following form for WM_COMMAND and WM_NOTIFY notifications:
ON_Notification( id, memberFxn )
The parent's function prototype is as follows:
/* for WM_COMMAND notifications */ afx_msg void memberFxn( );
/* for WM_NOTIFY notifications */ afx_msg void memberFxn(NMHDR * pNotifyStruct, LRESULT* result);
Notification specifies one of the available notification codes listed in Notifications. id specifies the child window ID of the control sending the notification and memberFxn is the name of the parent member function in your application which handles the notification.
// Event handler prototype added to dialog class afx_msg void OnSelChange();
// Event handler(s) added to message map BEGIN_MESSAGE_MAP(CYourDialog, CDialog) ON_SFTTREEN_SELCHANGE(IDC_TREE, OnSelChange) END_MESSAGE_MAP()
// event handler implementation void CYourDialog::OnSelChange() { // get index of the newly selected item int index = m_Tree.GetCurSel(); }
By overriding the OnChildNotify function of an object derived from CSftTree, you can handle messages in the object's class. The parameters are as documented in Notifications. Please see the Visual C++ documentation for additional information regarding the OnChildNotify function. However, the use of message reflection as shown next is the preferred method to handle messages.
MFC defines the ON_CONTROL_REFLECT and ON_NOTIFY_REFLECT macros which allow adding notifications directly to the message map. SftTree/DLL implements all required macros based on ON_CONTROL_REFLECT and ON_NOTIFY_REFLECT. See the MFC documentation for more information on message reflection.
Message-map entries take the following form:
ON_Notification_REFLECT( memberFxn )
The function prototype is as follows:
/* for WM_COMMAND notifications */ afx_msg void memberFxn( );
/* for WM_NOTIFY notifications */ afx_msg void memberFxn(NMHDR * pNotifyStruct, LRESULT* result);
Notification specifies one of the available notification codes listed in Notifications. memberFxn is the name of the member function in your object's class which handles the notification.
BEGIN_MESSAGE_MAP(CYourTree, CSftTree) ON_WM_CREATE() ON_SFTTREEN_SELCHANGE_REFLECT(OnSelChangeReflect) END_MESSAGE_MAP()
// event handler implementation void CYourTree::OnSelChangeReflect() { // get index of the newly selected item int index = GetCurSel(); }