Domanda

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?

È stato utile?

Soluzione 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)

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top