<?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 : CXTPControlComboBox shallow copy bug</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : CXTPControlComboBox shallow copy bug]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 08 Jun 2026 00:58:40 +0000</pubDate>
  <lastBuildDate>Fri, 26 Jul 2019 07:00:44 +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=23886</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[CXTPControlComboBox shallow copy bug : I am adding aCXTPControlComboBox...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23886&amp;PID=77433&amp;title=cxtpcontrolcombobox-shallow-copy-bug#77433</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=8760">rhfritz</a><br /><strong>Subject:</strong> 23886<br /><strong>Posted:</strong> 26 July 2019 at 7:00am<br /><br /><div> I am adding a&nbsp;CXTPControlComboBox to a toolbar and getting a handle to it like this:</div><div><br></div><div>pToolBarCombo = (CXTPControlComboBox*)GetControls()-&gt;Add(xtpControlComboBox, IDC_COMBO, 0, CAPTION_ADD_BEFORE);</div><div><br></div><div>I then use the pointer to set attributes and add rows to the combo box.&nbsp; And most notably, I'm using SetItemData() to set the DWORD_PTR associated with each item to an internal data type I need to reference as each combo item is selected.</div><div><br></div><div>However, when using the built-in mechanism allowing a user to add/remove buttons from the toolbar, I've noted that I can hide this combo box and restore it.&nbsp; However, upon restoring it, the combo text is all correct but the GetItemData() values are all NULL.</div><div><br></div><div>I've noted that the control pointer value changes&nbsp; between the Add above and the subsequently retrieved value:</div><div><br></div><div>CXTPControlComboBox *<span style="display: inline !imant; : n&#111;ne; : transparent; color: rgb0, 0, 0; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; orphans: 2; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; text-trans: n&#111;ne; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">pToolBarCombo </span>= (dynamic_cast&lt;CXTPControlComboBox*&gt;(CUtilXtreme::GetCommandBarControl(this, IDC_COMBO)));</div><div><br></div><div>This implies that the object is being copied and removed from the toolbar and then restored, but it seems like a shallow rather than a deep copy was done.</div><div><br></div><div><div style=": transparent; color: rgb0, 0, 0; : n&#111;ne; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; overflow: ; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; text-trans: n&#111;ne; -webkit-text-stroke-width: 0px; white-space: normal; width: 1332.6px; word-spacing: 0px;">FWIW: I've verified that&nbsp;</div><div style=": transparent; color: rgb0, 0, 0; : n&#111;ne; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; overflow: ; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; text-trans: n&#111;ne; -webkit-text-stroke-width: 0px; white-space: normal; width: 1332.6px; word-spacing: 0px;">void CXTPControlComboBoxList::Copy(CXTPCommandBar* pCommandBar, BOOL bRecursive); &nbsp;</div><div style=": transparent; color: rgb0, 0, 0; : n&#111;ne; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; overflow: ; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; text-trans: n&#111;ne; -webkit-text-stroke-width: 0px; white-space: normal; width: 1332.6px; word-spacing: 0px;">does a deep copy. &nbsp; But that just means that whatever is preserving the ComboBox list for unhiding is likely not another ComboBox.</div><div style=": transparent; color: rgb0, 0, 0; : n&#111;ne; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; overflow: ; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; text-trans: n&#111;ne; -webkit-text-stroke-width: 0px; white-space: normal; width: 1332.6px; word-spacing: 0px;"><br style="color: rgb0, 0, 0; : n&#111;ne; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-weight: 400; line-height: 16.8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow: ; width: auto;"></div><div style=": transparent; color: rgb0, 0, 0; : n&#111;ne; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; overflow: ; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; text-trans: n&#111;ne; -webkit-text-stroke-width: 0px; white-space: normal; width: 1332.6px; word-spacing: 0px;">But I have also discovered a workable solution:</div><div style=": transparent; color: rgb0, 0, 0; : n&#111;ne; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; overflow: ; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; text-trans: n&#111;ne; -webkit-text-stroke-width: 0px; white-space: normal; width: 1332.6px; word-spacing: 0px;"><div>&nbsp;&nbsp;<span style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; orphans: 2; text-align: left; text-decorati&#111;n: n&#111;ne; text-indent: 0px; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">pToolBarCombo </span>-&gt;SetFlags(xtpFlagNoMovable);&nbsp;// Disables the ability to remove the combo during customization as it no longer appears on the buttons customization submenu displayed by Add/Remove.</div><div><br></div><div>So for now I've mitigated the bad thing by preventing the user from performing the action causing it.</div></div></div><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div>Any insight or other recommendations appreciated.</div>]]>
   </description>
   <pubDate>Fri, 26 Jul 2019 07:00:44 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23886&amp;PID=77433&amp;title=cxtpcontrolcombobox-shallow-copy-bug#77433</guid>
  </item> 
 </channel>
</rss>