Question about CComboBox Control 
Author Message
 Question about CComboBox Control

I am using PPC2002 and eVC++3.0.

I designed a dialog-based program with CComboBox Control inside. To avoid
resource leakage and speed the performance, I did not delete current dialog
before I move to a new dialog. Instead, I hide it by ShowWindow (SW_HIDE) so
it is still in the memory, and I can display it later if I need to come
back. However, I found every time when I come back to a dialog, the items
inside of the CComboBox Control are doubled. For example, from
{"Odd";"Even"} to {"Odd";"Even", "Odd";"Even"}.

I found a method to solve this problem by Reset it and add the items again.
For example:
 m_Combo1.ResetContent ();
 m_Combo1.AddString (_T("Odd"));
 m_Combo1.AddString (_T("Even"));

However, it takes time to reset and add the items particularly when there
are lots of CComboBox controls. Anybody can provide an alternative solution
to speed the software?

Thanks in advance.

John



Wed, 14 Dec 2005 04:56:46 GMT  
 Question about CComboBox Control
When do you populate the control? Is it simply invoked twice by a load/show
event?


Sun, 18 Dec 2005 06:49:31 GMT  
 Question about CComboBox Control
Thanks, I checked the codes, and it is not invoked twice by a load/show.

I tried another test by not using AddString() function, instead, I set the
items of CComboBox in Resource View, and I found the same thing happened:
the items are doubled when I come back from another dialog. So AddString()
is not the reason. I hide the dialog before I go to a new dialog, and
display it as well run OnInitDialog() again when I come back. It is the
OnInitDialog() causing the problem.

John



Quote:
> When do you populate the control? Is it simply invoked twice by a
load/show
> event?



Mon, 19 Dec 2005 00:16:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CComboBox control question

2. Question about using CComboBox Control??Thank you

3. A couple CTreeCtrl questions and a CComboBox question

4. limit of CComboBox and handling of scrolling event in a CComboBox

5. CComboBox control variable

6. CComboBox 'Sort'ing Under Program Control?

7. My CComboBox - how to disable control

8. CComboBox Control doesn′t work.....

9. How to set margins in a CCombobox control

10. Dropdown list in combination with the editfield in CCombobox control

11. CComboBox : Adding New Items from the built in CEdit Control

12. CComboBox: Getting Text from the Edit Control

 

 
Powered by phpBB® Forum Software