<?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 : CXTPC&#111;ntrolBomboBox bug with Manual Updat</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : CXTPC&#111;ntrolBomboBox bug with Manual Updat]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 20 Apr 2026 20:52:32 +0000</pubDate>
  <lastBuildDate>Sun, 28 Mar 2004 13:56:32 +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=577</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[CXTPC&#111;ntrolBomboBox bug with Manual Updat : Edited original post to add acall...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=577&amp;PID=1480&amp;title=cxtpcontrolbombobox-bug-with-manual-updat#1480</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=350">vladsch</a><br /><strong>Subject:</strong> 577<br /><strong>Posted:</strong> 28 March 2004 at 1:56pm<br /><br />Edited original post to add a&nbsp;call to base class in OnExecute.]]>
   </description>
   <pubDate>Sun, 28 Mar 2004 13:56:32 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=577&amp;PID=1480&amp;title=cxtpcontrolbombobox-bug-with-manual-updat#1480</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPC&#111;ntrolBomboBox bug with Manual Updat : Bug occurs if the CXTPControlComboBox...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=577&amp;PID=1479&amp;title=cxtpcontrolbombobox-bug-with-manual-updat#1479</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=350">vladsch</a><br /><strong>Subject:</strong> 577<br /><strong>Posted:</strong> 28 March 2004 at 11:25am<br /><br /><P>Bug occurs if the CXTPControlComboBox control is set to manual update and SetDropDownListStyle(false). </P><P>To duplicate modify the CustomThemes sample to create a manual update combobox (make sure to delete the saved toolbars from the registry otherwise the old stored non-manual control will be used)</P><P>1. drop the list by clicking on the combobox<BR>2. move the mouse so that an item is highlighted (other than the currently selected item)<BR>3. click outside the list box so that the list box is closed without any selection being made.&nbsp; </P><P>The combo box repaints with the new item even though it was not selected. Moving the mouse over the combobox causes it to repaint with the correct content.</P><P>The problem is caused during repaint while the list is dropped. The current selection for the list changes to follow the mouse movements so when GetText() method for the combobox is called from OnPaint while the list is dropped it uses the list's current selection to extract the string which will be the last hovered over item instead of the last selected item.</P><P>The solution that I used was to store the last selected item before poping up the list and restoring it when the popup is closed. This stored selection is modifed to the new selection in the OnSetSelected and OnExecute so that restoring the last selected value will not undo the new selection.</P><P><strong>new or changed code is bold</strong></P><P><strong>CXTPControlComboBox.h</strong> add a new protected members to CXTPControlComboBox<BR><table width="99%"><tr><td><pre class="BBcode"><strong><BR>&nbsp;&nbsp;&nbsp; // Input:&nbsp;&nbsp; bPopup - TRUE to set popup.<BR>&nbsp;&nbsp;&nbsp; // Returns: TRUE if successful; otherwise returns FALSE<BR>&nbsp;&nbsp;&nbsp; // Summary: This method is called to popup the control.<BR>&nbsp;&nbsp;&nbsp; virtual BOOL OnSetPopup(BOOL bPopup);</P><P>&nbsp;&nbsp;&nbsp; // Summary: This method is called when the control is executed.<BR>&nbsp;&nbsp;&nbsp; virtual void OnExecute();</P><P>&nbsp;&nbsp;&nbsp; int m_nLastSel;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // last user selected index, (used during display of list box)<BR></strong></pre></td></tr></table></P><P>in <strong>CXTPControlComboBox.cpp</strong></P><P>in the Constructor Clear the new member to -1, not really needed but good practice<BR><table width="99%"><tr><td><pre class="BBcode"><BR>&nbsp;&nbsp;&nbsp; m_nLastSel = -1;<BR></pre></td></tr></table></P><P>Change/Add the following functions:</P><P><table width="99%"><tr><td><pre class="BBcode"><BR>CString CXTPControlComboBox::GetText()<BR>{<BR>&nbsp;&nbsp;&nbsp; int nSel = <strong>GetDroppedState() ? m_nLastSel : </strong>((CListBox*)m_pCommandBar)-&gt;GetCurSel();<BR>&nbsp;&nbsp;&nbsp; CString str;<BR>&nbsp;&nbsp;&nbsp; if (nSel &gt;= 0)<BR>&nbsp;&nbsp;&nbsp; ((CListBox*)m_pCommandBar)-&gt;GetText(nSel, str);<BR>&nbsp;&nbsp;&nbsp; return str;<BR>}</P><P>void CXTPControlComboBox::OnSelChanged()<BR>{<BR>&nbsp;&nbsp;&nbsp; <strong>m_nLastSel = GetCurSel();</strong></P><P>&nbsp;&nbsp;&nbsp; if (m_pEdit &amp;&amp; m_pEdit-&gt;GetSafeHwnd()) m_pEdit-&gt;SetWindowText(GetText()); else m_strEditText = GetText();<BR>&nbsp;&nbsp;&nbsp; if (m_pParent &amp;&amp; m_pParent-&gt;GetSafeHwnd()) m_pParent-&gt;Invalidate(FALSE);<BR>}</P><P><strong>BOOL CXTPControlComboBox::OnSetPopup(BOOL bPopup)<BR>{<BR>&nbsp;&nbsp;&nbsp; if (bPopup)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_nLastSel = GetCurSel();<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetCurSel(m_nLastSel);<BR>&nbsp;&nbsp;&nbsp; }</P><P>&nbsp;&nbsp;&nbsp; return CXTPControlPopup::OnSetPopup(bPopup);<BR>}</strong></P><P><strong>void CXTPControlComboBox::OnExecute()<BR>{<BR>&nbsp;&nbsp;&nbsp; m_nLastSel = GetCurSel();<BR>&nbsp;&nbsp;&nbsp; CXTPControlPopup::OnExecute();<BR>}</strong><BR></pre></td></tr></table></P><P>&nbsp;</P><span style="font-size:10px"><br /><br />Edited by vladsch</span>]]>
   </description>
   <pubDate>Sun, 28 Mar 2004 11:25:47 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=577&amp;PID=1479&amp;title=cxtpcontrolbombobox-bug-with-manual-updat#1479</guid>
  </item> 
 </channel>
</rss>