Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to receive the click message from the checkbox in CExtTreeCtrl Collapse All
Subject Author Date
Robert Hofstetter May 6, 2010 - 1:40 AM

I have a CExtTreeCtrl with some checkbox items and need to do something when user clicks(Check/Uncheck) on the checkbox.


How do I get the message? Could you show me some sample code, Thanks


 

Technical Support May 6, 2010 - 1:47 PM

The CExtTreeCtrl control is not a simply repainted version of the CTreeCtrl control. The CExtTreeCtrl control provides extended features like controls attached to each tree item, multiple item selection, disabled items, checked and radio-checked tree items. The check boxes of the CExtTreeCtrl control are not based on the check boxes of the CTreeCtrl control. The CExtTreeCtrl control supports per-tree-item optional check boxes. Both two-state and tree-state checkboxes are supported. You can see this on the Tree View dialog page in the ProfUIS_Controls sample application. Here is how the check boxes initialized in the CPageTreeCtrl::OnInitDialog() method in this sample application:

   hti = m_wndTree.InsertItem( _T("Two-state check box"), htiCheckBoxes, NULL );
            m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_check_box;

            hti = m_wndTree.InsertItem( _T("Three-state check box"), htiCheckBoxes, NULL );
            m_wndTree.TreeItemInfoGet( hti ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_tri_state_check_box;

The check box state is stored in the CExtTreeCtrl::TREEITEMINFO_t::m_nCheckBoxState property. You can access the CExtTreeCtrl::TREEITEMINFO_t data structure describing extended tree item using the CExtTreeCtrl::TreeItemInfoGet() method.
The check box state changing event does not have a dedicated messages and virtual methods. Please override the CExtTreeCtrl::OnTreeMouseClick() virtual method and add the OnKeyDown() handler method for the WM_KEYDOWN message into your CExtTreeCtrl-derived class. Your methods should remember the checked state of a tree item, invoke the parent class method and analyze the new checked state of the same tree item.