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 » CAdvTreeCtrl doesn't support TVS_CHECKBOXES Collapse All
Subject Author Date
Robert Webb Mar 9, 2010 - 4:53 PM

Hi,


We are porting old MFC code to Prof-UIS.  But changing from CTreeCtrl to CAdvTreeCtrl means we lose our check boxes.  We defined our check boxes using:


m_treeCtrl.ModifyStyle(0, TVS_CHECKBOXES);


This is suggested in the MSDN help for CTreeCtrl::SetCheck().


I know there’s some new way to set up check boxes using something like this:


m_treeCtrl.TreeItemInfoGet(hItem).m_eCheckBoxType = CExtTreeCtrl::e_cbt_check_box;


But it would obviously be easier if we didn’t have to change code to be Prof-UIS specific.  Shouldn’t CAdvTreeCtrl be back-compatible?


Thanks,


Rob.

Technical Support Mar 10, 2010 - 2:06 PM

Yes, the CExtTreeCtrl control is only partially back-compatible with the MFC’s CTreeCtrl control. Our tree control provides richer features than those in a tree view common control. Not all the standard notifications of the tree view common control meet the requirements of the CExtTreeCtrl control. That’s why you should override the CExtTreeCtrl control’s virtual methods in most cases. If you need only the standard CTreeCtrl control with themed by Prof-UIS scroll bars, then you can use the CExtNCSB < CTreeCtrl > template based class. The CExtNCSB template decorator class adds themed-by-Prof-UIS scroll bars to other windows.

Robert Webb Mar 10, 2010 - 5:03 PM

Well I’ve got it working using the CExtTreeCtrl now.  However you didn’t comment on the values returned by HitTest().  This appears to be a bug in Prof-UIS.  When a check-box is present (I didn’t test other times), TVHT_ONITEMLABEL is returned when clicking on the check-box, while TVHT_ONITEMRIGHT is returned when clicking on the label.  These are simply wrong aren’t they?  The label should return TVHT_ONITEMLABEL, and the check-box should return TVHT_ONITEMSTATEICON.


Thanks,


Rob.

Technical Support Mar 11, 2010 - 7:34 AM

Please use the CExtTreeCtrl::TreeItemHitTest() method and __EXT_TVHT_*** flags.

Robert Webb Mar 9, 2010 - 6:47 PM

Oops, I meant CExtTreeCtrl above, not CAdvTreeCtrl.


I’ve played with this a bit more, trying to do it the Prof-UIS way.  It seems check boxes also can’t be ticked in the same way as we used to use for CTreeCtrl (using TreeView_SetItem()), but I’ve sorted that out too.


Now my problem is with the result from CExtTreeCtrl::HitTest(pt, &flags).  For items with check boxes, it seems to set flags to TVHT_ONITEMLABEL when clicking on the check box.  That can’t be right can it?  That should mean clicking on the text.  If you do click on the text it returns TVHT_ONITEMRIGHT, which is also wrong.  With the MFC CTreeCtrl, clicking on the check box sets flags to TVHT_ONITEMSTATEICON, which our code relies on.


Thanks,


Rob.

Robert Webb Mar 9, 2010 - 6:58 PM

Hmm, a search of Prof-UIS code shows that TVHT_ONITEMSTATEICON is never set or used at all, so it looks like this was just left out?  This should be returned when clicking on the check box.


Rob.