<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : CXTTreeCtrl</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Controls : CXTTreeCtrl]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 13 May 2026 03:31:49 +0000</pubDate>
  <lastBuildDate>Fri, 04 Dec 2009 17:50:10 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=15673</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[CXTTreeCtrl : If the CXTTreeCtrl is derived...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=15673&amp;PID=55399&amp;title=cxttreectrl#55399</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 15673<br /><strong>Posted:</strong> 04 December 2009 at 5:50pm<br /><br /><FONT color=#000000>If the CXTTreeCtrl is derived from CTreeCtrl, then it is probably getting the "old yeller" tooltip (XP) from the MFC/OS control. I have turned that tip off on some of our MFC/OS based controls by calling SetTooltips(NULL). CTreeCtrl has that method too and we have a tree control derived from the MFC one on whch I have implemented the CJ office style tip. You have to create the CJ tooltip context for the tree control, set up the theme and implement the tipping yourself (I usually use the static CJ tip context's&nbsp;FillinToolInfo method call from my OnToolHitTest code.)</FONT><DIV>&nbsp;</DIV><FONT size=2><FONT size=2><P><FONT color=#000000>void</FONT></FONT></FONT><FONT size=2><FONT color=#000000> MyTreeCtrl::OnMouseMove( UINT nFlags, CPoint point )</FONT></P><P><FONT color=#000000>{</FONT></P><P><FONT color=#000000>SetToolTips( NULL );</FONT></P><DIV><FONT color=#000000></FONT></DIV><DIV><FONT color=#000000>...</FONT></DIV><DIV><FONT color=#000000>}</FONT></DIV><DIV><FONT color=#000000></FONT>&nbsp;</DIV><FONT size=2><FONT size=2><P><FONT color=#000000>class</FONT></FONT></FONT><FONT color=#000000><FONT size=2> </FONT><FONT size=2><FONT size=2>__declspec</FONT></FONT><FONT size=2>(FUNC_DECL) MyTreeCtrl : </FONT><FONT size=2><FONT size=2>public</FONT></FONT></FONT><FONT size=2><FONT color=#000000> CTreeCtrl</FONT></P><P><FONT color=#000000>{</FONT></P><DIV><FONT color=#000000></FONT></DIV><DIV><FONT color=#000000>...</FONT></DIV><DIV><FONT size=2><P><FONT color=#000000>CXTPToolTipContext m_ToolTipContext;</FONT></P><DIV><FONT color=#000000>}</FONT></DIV><DIV><FONT color=#000000></FONT>&nbsp;</DIV><DIV><FONT size=2><P><FONT color=#000000>BOOL MyTreeCtrl::PreTranslateMessage( MSG* pMsg )</FONT></P><P><FONT color=#000000>{</FONT></FONT><FONT size=2><FONT size=2></P></FONT></FONT><FONT size=2><P><FONT color=#000000>BOOL bPreTrans = TRUE;</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>if</FONT></FONT><FONT size=2><FONT color=#000000>( m_bUseCodejockTips )</FONT></P><P><FONT color=#000000>{</FONT></P><P><FONT color=#000000>m_ToolTipContext.FilterToolTipMessage(</FONT></FONT><FONT size=2><FONT color=#000000 size=2>this</FONT></FONT><FONT size=2><FONT color=#000000>, pMsg);</FONT></P><P><FONT color=#000000>}</FONT></P><P><FONT color=#000000>bPreTrans = CTreeCtrl::PreTranslateMessage( pMsg );</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>return</FONT></FONT><FONT size=2><FONT color=#000000> bPreTrans;</FONT></P><P><FONT color=#000000>}</FONT></P><DIV><FONT color=#000000></FONT></DIV><FONT size=2><P><FONT color=#000000>INT_PTR MyTreeCtrl::OnToolHitTest(CPoint point, TOOLINFO* pTI) </FONT></FONT><FONT size=2><FONT size=2><FONT color=#000000>const</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>{</FONT></P><P><FONT color=#000000>UINT temp = 0;</FONT></P><P></FONT><FONT color=#000000><FONT size=2><FONT size=2>if</FONT></FONT><FONT size=2>( </FONT><FONT size=2><FONT size=2>false</FONT></FONT></FONT><FONT size=2><FONT color=#000000> == m_bUseCodejockTips )</FONT></P><P><FONT color=#000000>{</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>return</FONT></FONT><FONT size=2><FONT color=#000000> CTreeCtrl::OnToolHitTest( point, pTI );</FONT></P><P><FONT color=#000000>}</FONT></P><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>else</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>{</FONT></P><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>//CPoint treePt = point;</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>//ClientToScreen( &amp;treePt );</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>//m_tree.ScreenToClient( &amp;treePt );</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>////TVHITTESTINFO HitTestInfo;</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>//HTREEITEM hItem = HitTest( treePt, 0 );</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>HTREEITEM hItem = HitTest( point, &amp;temp );</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>if</FONT></FONT><FONT size=2><FONT color=#000000>( hItem )</FONT></P><P><FONT color=#000000>{</FONT></P><P><FONT color=#000000>pTI-&gt;lpszText = NULL;</FONT></P><P><FONT color=#000000>pTI-&gt;hwnd = GetSafeHwnd();</FONT></P><P><FONT color=#000000>pTI-&gt;uId = (UINT_PTR)hItem;</FONT></FONT><FONT size=2><FONT size=2><FONT color=#000000>// both are the same size on 32/64 bit system</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// Get the item rectangle for the text only. The MSDN does not say so but at least on my Vista</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// machine I have found that passing in FALSE for bTextOnly results in the returned rectangle</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// being clipped to the client rect of the tree.</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>CRect rect;</FONT></P><P><FONT color=#000000>GetItemRect( hItem, &amp;rect, TRUE );</FONT></P><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// Now get the tree's client rectangle.</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>CRect clientRect;</FONT></P><P><FONT color=#000000>GetClientRect(&amp;clientRect);</FONT></P><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// Now union the two so I can see if the result is larger than the client rect. If it is, then</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// I assume the user cannot see all the text string and I will tip the user.</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>CRect unionRect;</FONT></P><P><FONT color=#000000>unionRect.UnionRect(&amp;clientRect,&amp;rect);</FONT></P><P><FONT color=#000000>BOOL bTip = unionRect != clientRect;</FONT></P><P></FONT><FONT color=#000000><FONT size=2><FONT size=2>if</FONT></FONT><FONT size=2>( </FONT><FONT size=2><FONT size=2>false</FONT></FONT></FONT><FONT size=2><FONT color=#000000> == bTip )</FONT></P><P><FONT color=#000000>{</FONT></P><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// Text may be within the client rect of the tree control but if it is pushed off-screen, say</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// by moving it to the right side of the monitor the text may not be visible to the user. So</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// I will compare to the desktop and tip if I think the user cannot see the full text.</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>CRect desktopRect;</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>if</FONT></FONT><FONT size=2><FONT color=#000000> (::GetWindowRect (GetDesktopWindow ()-&gt;GetSafeHwnd (), &amp;desktopRect))</FONT></P><P><FONT color=#000000>{</FONT></P><P><FONT color=#000000>AdjustDesktopRectForMultipleMonitors(&amp;desktopRect);</FONT></P><P><FONT color=#000000>ClientToScreen( clientRect );</FONT></P><P><FONT color=#000000>CRect intersectRect;</FONT></P><P><FONT color=#000000>intersectRect.IntersectRect( clientRect, desktopRect );</FONT></P><P><FONT color=#000000>bTip = intersectRect != clientRect;</FONT></P><P><FONT color=#000000>}</FONT></P><P><FONT color=#000000>}</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>if</FONT></FONT><FONT size=2><FONT color=#000000>( bTip )</FONT></P><P><FONT color=#000000>{</FONT></P><P><FONT color=#000000>CString strText = GetItemText( hItem );</FONT></P><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// I have also found that if I send in the "text only" rectangle, and the text is not fully</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// displayed due to the client rect, if the user places the mouse over the icon, CJ does not</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>// display the text. I need the item rect for the entire item.</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>CRect entireRect;</FONT></P><P><FONT color=#000000>GetItemRect( hItem, &amp;entireRect, FALSE );</FONT></P><P><FONT color=#000000>CXTPToolTipContext::FillInToolInfo( pTI, pTI-&gt;hwnd, entireRect, pTI-&gt;uId, strText );</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>return</FONT></FONT><FONT size=2><FONT color=#000000> (UINT_PTR)hItem;</FONT></P><P><FONT color=#000000>}</FONT></P><P><FONT color=#000000>}</FONT></P><P><FONT color=#000000>}</FONT></P><P></FONT><FONT color=#000000><FONT size=2><FONT size=2>return</FONT></FONT><FONT size=2> -1; </FONT><FONT size=2><FONT size=2>// not found</P></FONT></FONT></FONT><FONT size=2><P><FONT color=#000000>}</FONT></P><DIV><FONT color=#000000>At some point, init the context member data to your liking. Here's what I do:</FONT></DIV><DIV><FONT color=#000000></FONT></FONT></FONT></FONT><FONT size=2><FONT size=2><FONT size=2><FONT size=2></FONT></FONT></FONT></FONT>&nbsp;</DIV><DIV><FONT color=#008000 size=2><FONT color=#008000 size=2><FONT size=2><FONT color=#000000 size=2>void</FONT></FONT><FONT size=2><FONT color=#000000> InitializeCXTPToolTipContext( CXTPToolTipContext* pToolTipContext )</FONT></DIV><P><FONT color=#000000>{</FONT></P><P></FONT><FONT size=2><FONT color=#000000 size=2>if</FONT></FONT><FONT size=2><FONT color=#000000>( pToolTipContext )</FONT></P><P><FONT color=#000000>{</FONT></FONT><FONT size=2><FONT size=2></P></FONT></FONT><FONT size=2><P><FONT color=#000000>pToolTipContext-&gt;SetDelayTime(TTDT_INITIAL, 300);</FONT></P><P><FONT color=#000000>pToolTipContext-&gt;SetDelayTime(TTDT_RESHOW, 0);</FONT></FONT><FONT size=2><FONT size=2><FONT color=#000000>// even 1 is useless</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>pToolTipContext-&gt;SetDelayTime(TTDT_AUTOPOP, 15000);</FONT></FONT><FONT size=2><FONT size=2><FONT color=#000000>// appears to be useless</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>pToolTipContext-&gt;SetStyle(xtpToolTipOffice2007);</FONT></P><P><FONT color=#000000>pToolTipContext-&gt;ShowTitleAndDescription();</FONT></P><P><FONT color=#000000>pToolTipContext-&gt;ShowImage(TRUE, 0);</FONT></P><P><FONT color=#000000>pToolTipContext-&gt;SetMargin(CRect(5, 5, 5, 5));</FONT></P><P><FONT color=#000000>pToolTipContext-&gt;SetMaxTipWidth(300);</FONT></P><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>//pToolTipContext-&gt;SetDelayTime(TTDT_INITIAL, 900);</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT size=2><FONT size=2><FONT color=#000000>//pToolTipContext-&gt;SetDelayTime(TTDT_RESHOW, 900);</FONT></P></FONT></FONT><FONT size=2><P><FONT color=#000000>pToolTipContext-&gt;SetTipBkColor(XTPColorManager()-&gt;GetColor(COLOR_GRADIENTINACTIVECAPTION));</FONT></P><P><FONT color=#000000></FONT></P><P><FONT color=#000000>}</FONT></P><P><FONT color=#000000>}</FONT></P></FONT></DIV></FONT></FONT></FONT></FONT></DIV>]]>
   </description>
   <pubDate>Fri, 04 Dec 2009 17:50:10 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=15673&amp;PID=55399&amp;title=cxttreectrl#55399</guid>
  </item> 
  <item>
   <title><![CDATA[CXTTreeCtrl : Hi   My CXTResizeDialog has...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=15673&amp;PID=55034&amp;title=cxttreectrl#55034</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=5514">feffe</a><br /><strong>Subject:</strong> 15673<br /><strong>Posted:</strong> 20 November 2009 at 8:55am<br /><br />Hi <DIV>&nbsp;</DIV><DIV>My CXTResizeDialog has a CXTTreeCtrl inside.</DIV><DIV>&nbsp;</DIV><DIV>I'd like that my TreeCtrl has tooltips with Office style, and that when the tooltip is shown</DIV><DIV>for a SELECTED item of the tree, the tooltip changes background color.</DIV><DIV>&nbsp;</DIV><DIV>I think that the 2 problems are related...</DIV><DIV>&nbsp;</DIV><DIV>I've tried to apply the code of ToolTipContext Sample propertiesdialog.cpp,</DIV><DIV>but probably set the theme for a treectrl is quite different than for a button.</DIV><DIV>&nbsp;</DIV><DIV>Could anybody help me?</DIV><DIV>&nbsp;</DIV><DIV>Thanks a lot :)</DIV><DIV>&nbsp;</DIV><DIV>EDIT: The main question is... Can I have office-like tooltips in a treectrl???</DIV>]]>
   </description>
   <pubDate>Fri, 20 Nov 2009 08:55:41 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=15673&amp;PID=55034&amp;title=cxttreectrl#55034</guid>
  </item> 
 </channel>
</rss>