Hi,
I am trying to use a combo box in my dialog. I created the combo box using the tool provideded by ms vs 2005. I added a variable connected to the combo box and ms vs automatically added this to my code:
Code:
CComboBox numNode; // in the .h file
DDX_Control(pDX, IDC_NUMNODE, numNode); // in the .cpp file
So far it looks alright. If I understand this correctly, the ddx control basically connects the numNode object to the UID IDC_NUMNODE.
Now I tried to add items to the combo box in my initDialog() function as follows:
Code:
BOOL filterFileCreator::OnInitDialog()
{
CDialog::OnInitDialog();
std::string nodeString = "";
int number = 0;
for(int i=1;i<max_node+1;i++) {
//charToInt(number,&nodeString);
//CDialog::SendDlgItemMessageA(IDC_NUMNODE,CB_ADDSTRING,0,(LPARAM) (LPCSTR) nodeString.c_str());
numNode.SetItemData(i, i);
}
...
}
Now if I do it using sendDlgItemMessage, it works and the combo box display the numbers but when i try setItemData, nothing is displayed. I would like to use the object associated with the combo box to do all my transaction. Any clues as to why. Thanks in advance
Amish