| Copy item data when CXTPControlComboBox cloned?
 
 Printed From: Codejock Forums
 Category:  Codejock Products
 Forum Name:  Command Bars
 Forum Description:  Topics Related to Codejock Command Bars
 URL: http://forum.codejock.com/forum_posts.asp?TID=22710
 Printed Date: 30 October 2025 at 11:52pm
 Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
 
 
 Topic: Copy item data when CXTPControlComboBox cloned?
 Posted By: franji1
 Subject: Copy item data when CXTPControlComboBox cloned?
 Date Posted: 01 September 2015 at 7:01pm
 
 
        
          | Whenever a toolbar that contains a CXTPControlComboBox is "customized", the next time it loads, the list contains all the text but all the item data is still 0. 
 The CXTPControlComboBox is "Copy"ed during a clone process, and the text is obviously copied, but the item data is not.
 
 What is the proper mechanism to set the item data when the original CXTPControlComboBox is copied?
 |  
 
 Replies:
 Posted By: franji1
 Date Posted: 02 September 2015 at 5:24pm
 
 
        
          | I found that the modified toolbars are serialized, and that it's actually the default behavior of the CXTPControlComboBoxList to just serialize the item text, not the item data. 
 This is DEFINITLY the CORRECT behavior.
 
 HOWEVER, what would be the proper mechanism to override this behavior, and also serialize the ItemData, along with the item text?
 
 Again, this is dealing with a customized toolbar (e.g. removed the Help button from the end) that also contains a CXTPControlComboBox.  So because the toolbar was "customized", it serialized the combo box (in addition to all the other controls in that toolbar), but without the item data.  So when I shut down and re-run the software, when it loads the customized toolbar, the combo box is there and looks fine, but when I select something, the item data for every item is 0, so ALL the entries behave like the "zeroth" entry.
   |  
 Posted By: rdhd
 Date Posted: 02 October 2015 at 12:28pm
 
 
        
          | Not sure if this will help in your case but we subclass some controls and override DoPropExchange(CXTPPropExchange* pPX) and save/read our data for customization purposes. 
 Also, I recently modified some code that used a CXTPControlComboBox derived class and I had to override the Copy method. Failing to do so caused me to loose data when the user right-clicked the control and ran "Add To QAT". I needed the extra data associated with the entries in order to generate image icons for the entries and didn't think about the Copy method until someone showed me the images were missing when the put the control on the QAT. I never thought about testing that :(
 
 |  
 
 |