|
-
May 25th, 1999, 06:22 AM
#1
COMBOBOX problems
I use a SDI Interface and i launch a DialogBox who contain a combobox,
before XXXX.DoModal(); I want to AddString or InsertString in the combobox but Visual c++ 6.0 d'ont want to execute this code.
Can you help me.
-
May 25th, 1999, 07:02 AM
#2
Re: COMBOBOX problems
You cant add strings to the combo-box before DoModal() because the combo box hasnt been created.
During the DoModal process, OnInitDialog (WM_INITDIALOG) is called (before the dlg is shown) and here you can add the strings to the combobox.
If what you are trying to do is something like a results list (i.e. you are doing some processing and adding strings to the list, then when you finish processing display the dlg) there are a few other options available to you.
1. In your application, create a CStringList, add the strings to this, and then pass the string list to the dlg before DoModal, and in OnInitDialog, iterate through the list and add the strings to the combo-box
2. Add a function to the dlg class to take the strings, which it then holds internally, and uses to populate the dlg during OnInitDialog.
-
May 25th, 1999, 07:03 AM
#3
Re: COMBOBOX problems
You should override your Dialog InitDialog() function like this:
BOOL CMyDialog::InitDialog()
{
CDialog::InitDialog();
(CComboBox*)GetDlgItem(IDC_COMBO1)->AddString("String1");
return TRUE;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|