Question

i've a little comboBox, and i want to fill it with 6 entries... . i wrote this code:

CComboBox* dropdownList = ((CComboBox*)GetDlgItem(IDC_PROGRAMDROPDOWN));
dropdownList->Clear();
dropdownList->AddString(L"test");
dropdownList->AddString(L"test2");
dropdownList->InsertString(2,L"test3");
dropdownList->InsertString(3,L"test4");
dropdownList->InsertString(4,L"test5");

As you can see I tried AddString(), and InsertString(). both with no effect. I also tried it just with AddString() which should be the correct way at initializing it.

But, my combobox is empty. I already debugged it, and this lines are hit but with no effect.

Do you have any idea?

Was it helpful?

Solution 2

thanks for all your answers. But it was an ugly Failure by my IDE -.-. I just recreated the UI-Element and it worked...

I recreated it with the same properties (Copy & Paste)

OTHER TIPS

In the dialog editor, make sure you resize the ComboBox item so that its height is big enough to contain all of the items when the ComboBox is expanded. By default, it'll only be the height of the "edit control" bit of the ComboBox, which limits the expanded height.

So, in the dialog editor, click on the dropdown button bit of the Combo Box and you should see the drag handles change a bit. Drag out the new size to account for all the items in the dropdown list.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top