<?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 : How to use CXTHeaderCtrl</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : How to use CXTHeaderCtrl]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 28 Apr 2026 11:28:22 +0000</pubDate>
  <lastBuildDate>Fri, 14 Mar 2008 13:48:34 +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=8334</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[How to use CXTHeaderCtrl : I&amp;#039;ve subclassed the CXTListHeader...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=32274&amp;title=how-to-use-cxtheaderctrl#32274</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2657">Algae</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 14 March 2008 at 1:48pm<br /><br />I've subclassed the CXTListHeader before and haven't had trouble with it.<br><br>However, if you are getting the dreaded CXTThemeManager assert: <br><br>ASSERT(m_factoryList.m_pHead == 0);<br><br>the manager is only trying to tell you that things are not cleaning up.&nbsp; It's just a little obscure is all. <br><br>Usually this problem has happened to me when I created a modeless dialog and forgot to add the cleanup to it. For example we can create a dialog (assume it is themed):<br><table width="99%"><tr><td><pre class="BBcode"><br>void CMainFrame::OnMyModelessDlg()<br>{<br>&nbsp;&nbsp;&nbsp; CMyModelessDlg*dlg = new CMyModelessDlg(AfxGetMainWnd());<br>&nbsp;&nbsp;&nbsp; dlg-&gt;Create(CMyModelessDlg::IDD);<br>&nbsp;&nbsp;&nbsp; dlg-&gt;ShowWindow(SW_SHOW);<br>}<br></pre></td></tr></table><br>Now, if you exit the program it will assert in CXTThemeManager! Unless we add this to the CMyModelessDlg class:<br><table width="99%"><tr><td><pre class="BBcode"><br>void CMyModelessDlg::PostNcDestroy() <br>{&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; CXTPDialog::PostNcDestroy();<br>&nbsp;&nbsp;&nbsp; delete this;<br>}<br></pre></td></tr></table><br>That will clean things up and the assert no longer happens.<br><br><br><br>]]>
   </description>
   <pubDate>Fri, 14 Mar 2008 13:48:34 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=32274&amp;title=how-to-use-cxtheaderctrl#32274</guid>
  </item> 
  <item>
   <title><![CDATA[How to use CXTHeaderCtrl : If you can send me a sample app,...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27078&amp;title=how-to-use-cxtheaderctrl#27078</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1">kstowell</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 08 October 2007 at 3:52pm<br /><br />If you can send me a sample app, I can debug it and try to provide a more stable solution for you. You can send it to <a href="mailto:support@codejock.com" target="_blank">support@codejock.com</A> if you like, just put it to my attention.<DIV>&nbsp;</DIV><DIV>Cheers,</DIV>]]>
   </description>
   <pubDate>Mon, 08 Oct 2007 15:52:56 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27078&amp;title=how-to-use-cxtheaderctrl#27078</guid>
  </item> 
  <item>
   <title><![CDATA[How to use CXTHeaderCtrl : Hi  yes,that&amp;#039;s what I ended...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27076&amp;title=how-to-use-cxtheaderctrl#27076</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2967">adrien</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 08 October 2007 at 3:10pm<br /><br />Hi<DIV>&nbsp;</DIV><DIV>yes,that's what I ended up doing.</DIV><DIV>&nbsp;</DIV><DIV>It's just that the code blows up when the app exits.&nbsp; I think there's a bug somewhere in the CJ framework which isn't removing style factories when things using them are destroyed.</DIV><DIV>&nbsp;</DIV><DIV>At the moment to stop it crashing (it still asserts though, which is really annoying) I had to new the instance of the CXTHeaderCtrl and not delete it (so leak).</DIV><DIV>&nbsp;</DIV><DIV>Since it derives from CHeaderCtrl, it should be usable like CHeaderCtrl, which works fine in this case (just no styles).</DIV>]]>
   </description>
   <pubDate>Mon, 08 Oct 2007 15:10:12 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27076&amp;title=how-to-use-cxtheaderctrl#27076</guid>
  </item> 
  <item>
   <title><![CDATA[How to use CXTHeaderCtrl :   adrien wrote:PS, I&amp;#039;m not...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27073&amp;title=how-to-use-cxtheaderctrl#27073</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1">kstowell</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 08 October 2007 at 10:52am<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by adrien" alt="Originally posted by adrien" style="vertical-align: text-bottom;" /> <strong>adrien wrote:</strong><br /><br />PS, I'm not using this in a list control.&nbsp; It's just a header control for a custom control I've written.</td></tr></table> <DIV>&nbsp;</DIV><DIV>This is could be the problem. The CXTHeaderCtrl was created as a companion to CXTListCtrl and CXTListView class, and most likely will not work when subclassed&nbsp;for other controls.</DIV><DIV>&nbsp;</DIV><DIV>Instead of subclassing the header by&nbsp;calling CWnd::SubclassWindow(HWND) have you tried to create the header and position it manually? You may have better results.</DIV><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode">if (!m_header.Create(&#091;args&#093;))</DIV><DIV>&nbsp;&nbsp;&nbsp; return FALSE;</pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>then:</DIV><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode">m_header.SetWindowPos(&#091;args&#093;);</pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>Regards,</DIV>]]>
   </description>
   <pubDate>Mon, 08 Oct 2007 10:52:40 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27073&amp;title=how-to-use-cxtheaderctrl#27073</guid>
  </item> 
  <item>
   <title><![CDATA[How to use CXTHeaderCtrl : PS, I&amp;#039;m not using this in...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27057&amp;title=how-to-use-cxtheaderctrl#27057</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2967">adrien</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 07 October 2007 at 8:20pm<br /><br />PS, I'm not using this in a list control.&nbsp; It's just a header control for a custom control I've written.<DIV>&nbsp;</DIV><DIV>Code for CXTListBase::SubclassHeader doesn't help either</DIV><DIV>&nbsp;</DIV><DIV>bool CXTListBase::SubclassHeader(bool bBoldFont/*= false*/)<BR>{<BR>&nbsp;// if we are not in report mode return false.<BR>&nbsp;if ((GetWindowLong(m_pListCtrl-&gt;m_hWnd, GWL_STYLE) &amp; LVS_TYPEMASK) != LVS_REPORT)<BR>&nbsp;&nbsp;return false;</DIV><DIV>&nbsp;// header was already subclassed!<BR>&nbsp;if (::IsWindow(m_flatHeader.GetSafeHwnd()))<BR>&nbsp;&nbsp;return false;</DIV><DIV>&nbsp;// Get the windows handle to the header control for the<BR>&nbsp;// list control then subclass the control.<BR>&nbsp;HWND hWndHeader = _xtGetHeaderCtrl()-&gt;GetSafeHwnd();<BR>&nbsp;if (!m_flatHeader.SubclassWindow (hWndHeader))<BR>&nbsp;&nbsp;return false;</DIV><DIV>&nbsp;// finish header initialization.<BR>&nbsp;m_flatHeader.InitializeHeader(bBoldFont);<BR>&nbsp;return true;<BR>}<BR></DIV><DIV>All it's doing is calling CWnd::SubclassHeader, but only if the control already hasn't been created.&nbsp; So how do we just use a CXTHeaderCtrl?&nbsp; It seems what you need to do is.</DIV><DIV>&nbsp;</DIV><DIV>1. Create some other control (not CXTHeaderCtrl).</DIV><DIV>2. Subclass it to be a CXTHeaderCtrl by having another object of type CXTHeaderCtrl say m_Header, and calling m_Header.SubclassWindow(hWndOfOtherCtrl)</DIV><DIV>&nbsp;</DIV><DIV>my code is:</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;m_Header.Create(HDS_HOTTRACK | HDS_HORZ | CCS_TOP | WS_CHILD | WS_VISIBLE, CRect(0,0,0,0), this, 1);<BR>&nbsp;m_Header.InitializeHeader(FALSE);<BR>&nbsp;m_Header.SetTheme(new CXTHeaderCtrlThemeOffice2003());</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;HDITEM item;<BR>...</DIV><DIV>&nbsp;m_Header.InsertItem(0, &amp;item);</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Sun, 07 Oct 2007 20:20:33 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27057&amp;title=how-to-use-cxtheaderctrl#27057</guid>
  </item> 
  <item>
   <title><![CDATA[How to use CXTHeaderCtrl : Thanks for that info.  I&amp;#039;m...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27056&amp;title=how-to-use-cxtheaderctrl#27056</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2967">adrien</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 07 October 2007 at 8:13pm<br /><br />Thanks for that info.<DIV>&nbsp;</DIV><DIV>I'm getting a few crashes though.&nbsp; When the app exits I get an assert </DIV><DIV>&nbsp;</DIV><DIV>&nbsp;ASSERT(m_factoryList.m_pHead == 0);<BR></DIV><DIV>in XTThemeManager.cpp(325)</DIV><DIV>&nbsp;</DIV><DIV>and then an access violation exception in </DIV><DIV>&nbsp;</DIV><DIV>AFXTLS.CPP(52) from CSimpleList::Remove() which has come from CXTThemeManagerStyleFactory::~CXTThemeManagerStyleFactory() call to m_hostList.RemoveAll();&nbsp; </DIV><DIV>&nbsp;</DIV><DIV>m_hostList.m_pHead&nbsp;are NULL in this case.</DIV><DIV>&nbsp;</DIV><DIV>but in CSimpleList::Remove, m_pHead is 0xfeeefeee (deleted memory) which is being dereferenced (in GetNextPtr)</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Sun, 07 Oct 2007 20:13:13 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27056&amp;title=how-to-use-cxtheaderctrl#27056</guid>
  </item> 
  <item>
   <title><![CDATA[How to use CXTHeaderCtrl : Hi Adrien, You can subclass the...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27050&amp;title=how-to-use-cxtheaderctrl#27050</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1">kstowell</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 07 October 2007 at 6:00pm<br /><br /><P>Hi Adrien,</P><P>You can subclass the CXTHeaderCtrl by calling the following method:</P><P><table width="99%"><tr><td><pre class="BBcode">virtual bool CXTListCtrl::SubclassHeader(bool bBoldFont = false)</pre></td></tr></table></P><P>Once the header is subclassed, you can then call the following method to access a pointer to the header control:</P><P><table width="99%"><tr><td><pre class="BBcode">CXTFlatHeaderCtrl* CXTListCtrl::GetFlatHeaderCtrl() const</pre></td></tr></table></P><P>NOTE: The CXTFlatHeaderCtrl class is actually obsolete and you should use CXTHeaderCtrl instead. The CXTFlatHeaderCtrl is only provided for backward compatibility with older versions.</P><P>The reason why the header control is not automatically instanciated when the CXTListCtrl object is created, is because there may be some cases where a user does not want to use the CXTHeaderCtrl.</P><P>Also, it is not necessary to derive a class from CXTHeaderCtrl in order to use it, however you can. You can also instanciate the CXTHeaderCtrl separately from the CXTListCtrl. The "ListCtrl" sample under the "Controls" section demonstrates this. Take a look at the "ListCtrlDlg.cpp" file, you will see the following code:</P><P><table width="99%"><tr><td><pre class="BBcode">// Get the windows handle to the header control for the<BR>// list control then subclass the control.<BR>HWND hWndHeader = m_listCtrl.GetDlgItem(0)-&gt;GetSafeHwnd();<BR>m_header.SubclassWindow(hWndHeader);<BR>// add bitmap images.<BR>m_header.SetBitmap(0, IDB_COLUMN_0, FALSE, RGB(0,255,0));<BR>m_header.SetBitmap(1, IDB_COLUMN_1, FALSE, RGB(0,255,0));<BR>m_header.SetBitmap(2, IDB_COLUMN_2, FALSE, RGB(0,255,0));<BR>// enable auto sizing.<BR>m_header.EnableAutoSize(TRUE);<BR>m_header.ResizeColumnsToFit();</pre></td></tr></table></P><P>Hope this helps,<BR></P>]]>
   </description>
   <pubDate>Sun, 07 Oct 2007 18:00:22 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27050&amp;title=how-to-use-cxtheaderctrl#27050</guid>
  </item> 
  <item>
   <title><![CDATA[How to use CXTHeaderCtrl : Hi  The documentation on CXTHeaderCtrl...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27048&amp;title=how-to-use-cxtheaderctrl#27048</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2967">adrien</a><br /><strong>Subject:</strong> 8334<br /><strong>Posted:</strong> 07 October 2007 at 4:51pm<br /><br /><P>Hi</P><DIV></DIV><DIV></DIV>The documentation on CXTHeaderCtrl isn't clear, and I'm having problems.<DIV>&nbsp;</DIV><DIV>Documentation doesn't show SetStyle() function, but it exists.&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>When I create a CXTHeaderCtrl as a member of another class, then I get a blow-up when that object is deleted.</DIV><DIV>&nbsp;</DIV><DIV>The themes is the main problem.&nbsp; </DIV><DIV>&nbsp;</DIV><DIV>It says I must call a windows API call SubclassWindow.&nbsp; There is no such API.&nbsp; </DIV><DIV>&nbsp;</DIV><DIV>* There is a CWnd::SubclassWindow, but this is no use if I already created the control.&nbsp; Why must I call this anyway?&nbsp; </DIV><DIV>* Must I only call this if I derived from CXTHeaderCtrl.&nbsp; </DIV><DIV>* Must I derive from CXTHeaderCtrl (and if so why????)</DIV><DIV>&nbsp;</DIV><DIV>Thanks</DIV><DIV><BR>Adrien</DIV>]]>
   </description>
   <pubDate>Sun, 07 Oct 2007 16:51:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=8334&amp;PID=27048&amp;title=how-to-use-cxtheaderctrl#27048</guid>
  </item> 
 </channel>
</rss>