Professional UI Solutions
Site Map   /  Register


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 General Discussion » How Can I Get "TVHT_ONITEMSTATEICON" Flag when i Click a CheckBox in a CExtTreeCtrl Collapse All
Subject Author Date
park ki tae Mar 26, 2010 - 10:11 PM

 I Want to check a state of  checkbox item in the CExtTreeCtrl,

so I add a  NM_CLICK notification handling function and run program.

When i click checkbox, but the HitTest(pt,&uFlags) returns TVHT_ONITEMRIGHT

So i changed CExtTreeCtrl to CTreeCtrl and run.

When i click checkbox, the HitTest(pt,&uFlags) returns TVHT_ONITEMSTATEICON  correctly

What’s the problem?

BOOL CTestDlg::OnInitDialog()



 HTREEITEM root = m_tree.InsertItem("D", NULL, NULL);

 HTREEITEM item = m_tree.InsertItem("1", root, NULL);

 m_tree.TreeItemInfoGet( item ).m_eCheckBoxType = CExtTreeCtrl::e_cbt_check_box;

 m_tree.InsertItem("2", root, NULL);

  return TRUE;  // return TRUE  unless you set the focus to a control


 void CTestDlg::OnClickTree1(NMHDR* pNMHDR, LRESULT* pResult)


   UINT uFlags;

   //HTREEITEM hClickedItem = m_ItemTree.HitTest(pt, &uFlags);


   DWORD pos = GetMessagePos();

   CPoint pt(LOWORD(pos), HIWORD(pos));



  HTREEITEM hClickedItem = m_tree.HitTest(pt,&uFlags);

 if( hClickedItem != NULL && (uFlags & TVHT_ONITEMSTATEICON)!= 0 )



 *pResult = 0;


Technical Support Mar 29, 2010 - 12:32 PM

The tree view common control does not support check boxes on very old Windows OS versions which are still supported by the Prof-UIS library. The CExtTreeCtrl control implements its own check boxes and radio buttons which are not based on the check boxes provided by the tree view common control. Besides, the CExtTreeCtrl control supports the per-tree-item check boxes and radio buttons. I.e. you can make only some of tree items displaying check boxes and radio buttons. The CExtTreeCtrl control also provides advanced features like attached controls. These features cannot be found in the tree view common control. As result, we had to provide our own APIs for working with the tree rows of the CExtTreeCtrl control and our own virtual methods for handling the CExtTreeCtrl control events. Please use the CExtTreeCtrl::TreeItemHitTest() method and the __EXT_TVHT_*** for hit testing tree items. The CExtTreeCtrl::OnTreeMouseClick() virtual method provides detailed information about the tree control mouse click event with detailed hittesting information.