Print Page | Close Window

Customising CXTPToolBar with combo

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=960
Printed Date: 18 May 2024 at 5:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Customising CXTPToolBar with combo
Posted By: brianh
Subject: Customising CXTPToolBar with combo
Date Posted: 20 July 2004 at 11:25am

I have a CXTPToolBar that contains a combo box.  In OnCreateControl() I create and add the CXTPControlComboBox object for the toolbar.

This all works fine but if you customise the toolbar by clicking on the 'toolbar options' button on the end of the toolbar and deselect the combo control, and then later add it back in again, you get an exception when you use it.

The OnCreateControl() function does not appear to get called a second time when you restore the combo but the control does not seem to be the original one - but the list box still contains all the items added to the original!!

Can anyone tell me how I should be handling this situation?  Thanks.




Replies:
Posted By: SuperMario
Date Posted: 20 July 2004 at 11:38am
Take a look at the DynamicPopups sample and possible even the CommonControls sample.  I believe the DynamicPopups sample does what you are describing.


Posted By: brianh
Date Posted: 21 July 2004 at 3:42am

Yes these samples do add controls to the toolbar but in my case I store a pointer to the control which becomes invalid after hiding/showing the control on the toolbar.

If I just use FindControl() to get the control this works okay after hiding/showing it but the data that was added to the original control with SetItemData()  is missing, and it no longer has a current selection (never mind the one it had when it was hidden) which makes no sense for my application.

What I need is a notification when the control is destroyed so I can clean up if necessary (I don't store pointers with SetItemData() but I might in the future) and a notification when it is redisplayed so I can initialize it properly.  Are there any such notifications?

Thanks.




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