Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Copy item data when CXTPControlComboBox cloned?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Copy item data when CXTPControlComboBox cloned?

 Post Reply Post Reply
Author
Message
franji1 View Drop Down
Groupie
Groupie
Avatar

Joined: 28 June 2005
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote franji1 Quote  Post ReplyReply Direct Link To This Post Topic: Copy item data when CXTPControlComboBox cloned?
    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?
Back to Top
franji1 View Drop Down
Groupie
Groupie
Avatar

Joined: 28 June 2005
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote franji1 Quote  Post ReplyReply Direct Link To This Post 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.   
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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 :(
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.