Print Page | Close Window

CXTPControlComboBox tidy-up problem

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=9250
Printed Date: 05 February 2025 at 12:56pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPControlComboBox tidy-up problem
Posted By: Pierre
Subject: CXTPControlComboBox tidy-up problem
Date 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?



Replies:
Posted By: Oleg
Date 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


Posted By: Pierre
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net