Print Page | Close Window

Saving CXTPControlComboBox items

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=6802
Printed Date: 05 July 2024 at 5:27am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Saving CXTPControlComboBox items
Posted By: esc67
Subject: Saving CXTPControlComboBox items
Date Posted: 04 April 2007 at 6:29pm

 

How can I persist a dynamic list of items for a CXTPControlComboBox that is inside a command bar?

 

 

I create a CXTPControlComboBox in CMainFrame::OnCreateControl in order to have a “command entry” box in a toolbox:

 

CXTPControlComboBox* pCommandComboBox = (CXTPControlComboBox*)CXTPControlComboBox::CreateObject();

pCommandComboBox->SetDropDownListStyle(TRUE);

pCommandComboBox->SetCaption(_T("Command >"));

pCommandComboBox->SetStyle(xtpComboLabel);

pCommandComboBox->SetFlags(xtpFlagControlStretched);

lpCreateControl->pControl = pCommandComboBox;

 

Each time the user types text in the textbox I add the string to the combobox list by calling InsertString.  This gives the user a list of recently used commands.

 

The problem is that the list of strings in the combobox are not persisted when the application quits. Apparently calling DoPropExchange on GetCommandBars() doesn’t work, so I tried saving and loading the items in my own file. However, the items get erased sometime after OnCreateControl is called.

 




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