<?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 : Bug and Suggesti&#111;n for CXTTabCtrl</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Bug and Suggesti&#111;n for CXTTabCtrl]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 11 Apr 2026 05:48:07 +0000</pubDate>
  <lastBuildDate>Fri, 18 Feb 2005 13:33:59 +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=1816</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[Bug and Suggesti&#111;n for CXTTabCtrl : I have a drawing app with a tab...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1816&amp;PID=5221&amp;title=bug-and-suggestion-for-cxttabctrl#5221</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=886">AndyS</a><br /><strong>Subject:</strong> 1816<br /><strong>Posted:</strong> 18 February 2005 at 1:33pm<br /><br /><P>I have a drawing app with a tab view which contains multiple pages. Each page represents some facet of the selected items&nbsp;in the current document&nbsp;(e.g. a text formatiing page, fill, outline etc etc). As the user selects different items the appropriate pages are slotted into and out of the tab view.</P><P>There was a lot of window flashing so I looked into the code. The problem is&nbsp;in the "DeleteView" Method in&nbsp;"CXTTabCtrlBaseEx" which is resetting the active view incorrectly on view delete. There is no code release number in the file but it's downloaded as of about one month ago. </P><P>The code comments indicates that the view is switched if the active view is being deleted but in fact no check is made and the active view is always updated. The effect is that the active page jumps left with each iteration and of course the windows flash as the active page is changed quickly in succession as pages are added and removed. The fix is to flag whether this is really a deletion of the active page (before the delete call) and gate the active view update so it is only done when actually needed. </P><P>I've attached the fixed function but I can;t seem to format it in this browser.</P><P>It would also be nice to have an "AddControl" option to not update the active view to the newly added control page. Where pages are being slotted in quietly I don't necessarily want them to become active.</P><FONT color=#0000ff size=2><P>void</FONT><FONT size=2> CMTBRoutesPropertyView::DeleteViewEx(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nView, BOOL bDestroyWnd</FONT><FONT color=#008000 size=2>/*=TRUE*/</FONT><FONT size=2>)</P><P>{</P><P>ASSERT_VALID(m_pTabCtrl);</P><P>ASSERT(( nView &gt;= 0 ) &amp;&amp; (m_pTabCtrl-&gt;GetItemCount() &gt; nView));</P><P></FONT><FONT color=#008000 size=2>// Now find the view we want to delete and remove it</P></FONT><FONT size=2><P>POSITION pos = m_tcbItems.FindIndex(nView);</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (pos != NULL)</P><P>{</P><P>CWnd* pView = m_tcbItems.GetAt(pos)-&gt;pWnd;</P><P></FONT><FONT color=#008000 size=2>// AJS - Quick fix to detect deletion of the active view</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>bool</FONT><FONT size=2> bActiveView = (pView == GetActiveView());</P><P></FONT><FONT color=#008000 size=2>// Ensure that we get no dangling pointers</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (m_pParentFrame &amp;&amp; m_pParentFrame-&gt;GetActiveView() == pView)</P><P>{</P><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (m_pLastActiveView &amp;&amp; ::IsWindow(m_pLastActiveView-&gt;m_hWnd)) {</P><P>m_pParentFrame-&gt;SetActiveView(m_pLastActiveView);</P><P>}</P><P></FONT><FONT color=#0000ff size=2>else</FONT><FONT size=2> {</P><P>m_pParentFrame-&gt;SetActiveView(NULL, FALSE);</P><P>m_pLastActiveView = NULL;</P><P>}</P><P>}</P><P></FONT><FONT color=#008000 size=2>// Remove item from list, and free memory.</P></FONT><FONT size=2><P>RemoveListItem( pos, bDestroyWnd );</P><P></FONT><FONT color=#008000 size=2>// Remove it from the tab control</P></FONT><FONT size=2><P>m_pTabCtrl-&gt;DeleteItem(nView);</P><P></FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nCount = m_pTabCtrl-&gt;GetItemCount();</P><P></FONT><FONT color=#008000 size=2>// AJS - Added bActiveView to leave well alone if deleting non-active views</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (bActiveView &amp;&amp; (nCount &gt; 0))</P><P>{</P><P></FONT><FONT color=#008000 size=2>// Finally, if we have just deleted the active view, reset the</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>// active tab to be the first view in the list</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (nView == 0) {</P><P>SetActiveView(nView);</P><P>}</P><P></FONT><FONT color=#0000ff size=2>else</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (nView &gt;= nCount) {</P><P>SetActiveView(nCount-1);</P><P>}</P><P></FONT><FONT color=#0000ff size=2>else</FONT><FONT size=2> {</P><P></FONT><FONT color=#008000 size=2>// AJS - Quick fix to force reselection of the same view ID. Previously</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>// this reset the active view to nView-1 which (assuming we are deleting</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>// the active view) bumps us to the next view to the left. Why is this</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>// any better than the one to the right which will now occupy our space</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>// so is marginally less jumpy on screen. </P></FONT><FONT size=2><P>SetActiveView(nView);</P><P>}</P><P></FONT><FONT color=#008000 size=2>// Reset the tooltips for the views we have left...</P></FONT><FONT size=2><P>ResetToolTips();</P><P>}</P><P>}</P><P>}</P></FONT><P><FONT face="Courier New, Courier, mono" size=2></FONT>&nbsp;</P>]]>
   </description>
   <pubDate>Fri, 18 Feb 2005 13:33:59 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1816&amp;PID=5221&amp;title=bug-and-suggestion-for-cxttabctrl#5221</guid>
  </item> 
 </channel>
</rss>