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?

有帮助吗?

解决方案 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)

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top