Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Saving CXTPControlComboBox items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Saving CXTPControlComboBox items

 Post Reply Post Reply
Author
Message
esc67 View Drop Down
Newbie
Newbie


Joined: 09 June 2005
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote esc67 Quote  Post ReplyReply Direct Link To This Post Topic: Saving CXTPControlComboBox items
    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.

 

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