Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPControlComboBox  tidy-up problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPControlComboBox tidy-up problem

 Post Reply Post Reply
Author
Message
Pierre View Drop Down
Newbie
Newbie


Joined: 08 January 2008
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pierre Quote  Post ReplyReply Direct Link To This Post Topic: CXTPControlComboBox tidy-up problem
    Posted: 08 January 2008 at 6:35am
I have a specialised type of CXTControlComboBox object residing on a CXTPToolBar object.  The combo box initialises itself by dynamically allocating objects and associating them with the list box via SetItemData.
 
The problem I have is that I cannot find a way to deallocate the associated objects on shutting down the application.  I have tried placing the tidy-up code both in an override of OnRemoved and the destructor of my specialised combo but these fail because I cannot iterate through the list items due to the fact that the list box window no longer exists, causing GetCount to fail.
 
Is there another event I can use to do my combo box tidy-up?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2008 at 3:17pm

A lot of ways.

for example clean all in OnDestroy. Also you can add some CArray variable, add items to this array and too the combo and delete in CArray in destruct.
 
You can also override CXTPControlComboBox and its OnRemove....
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Pierre View Drop Down
Newbie
Newbie


Joined: 08 January 2008
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pierre Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2008 at 3:18am

Thank you Oleg for your quick response.

As I am converting many different types of toolbar to become command bars I was looking for the cleanest solution for tidying up specialised combo boxes.  For this reason I was hoping to avoid having to set up an additional CArray or CPtrList.  Also, as mentioned in my original post, overriding CXTPControlComboBox and its OnRemove doesn't work because, by that time, the window of the list box no longer exists (thus preventing iteration down it to delete the associated objects).
 
If I understand you correctly it seems the only option left is to go down the route of OnDestroy which I assume would require a specialised CXTPControlComboBoxList where this would be handled.
 
What I was hoping for was to handle an event on the CXTPControlComboBox object telling me that the list box window was about to be destroyed.
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.063 seconds.