![]() |
CXTPControlComboBox tidy-up problem |
Post Reply ![]() |
Author | |
Pierre ![]() Newbie ![]() Joined: 08 January 2008 Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() 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?
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Pierre ![]() Newbie ![]() Joined: 08 January 2008 Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |