Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Customising CXTPToolBar with combo
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Customising CXTPToolBar with combo

 Post Reply Post Reply
Author
Message
brianh View Drop Down
Groupie
Groupie


Joined: 30 April 2004
Location: United Kingdom
Status: Offline
Points: 83
Post Options Post Options   Thanks (0) Thanks(0)   Quote brianh Quote  Post ReplyReply Direct Link To This Post Topic: Customising CXTPToolBar with combo
    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.

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
brianh View Drop Down
Groupie
Groupie


Joined: 30 April 2004
Location: United Kingdom
Status: Offline
Points: 83
Post Options Post Options   Thanks (0) Thanks(0)   Quote brianh Quote  Post ReplyReply Direct Link To This Post 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.

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.156 seconds.