Valhalla Legends Forums Archive | C/C++ Programming | Default list of strings in ComboBox

AuthorMessageTime
Okee
I've setup a ComboBox onto one of my forms. I can't seem to get it to show my list of default items in it when the form is drawn. I've entered them into the Properties window of the Combo Box, that didn't work. I tried sending CB_ADDSTRING, and CB_INSERTSTRING to the ComboBox and that didn't seem to work. Can anyone explain how to make a list of three or four different string appear in the ComboBox when the form its on is first drawn? I'm making a server list, if that makes things a little more clean. I want a few default servers to be listed (ie: useast.battle.net, asia.battle.net, etc)
December 1, 2004, 10:17 PM
Zakath
[code]BOOL CALLBACK ConfigProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
switch( uMsg ) {
case WM_INITDIALOG:
SendDlgItemMessage( hwnd, IDC_PRODUCT, CB_ADDSTRING, 0, (LPARAM)"Starcraft" );
SendDlgItemMessage( hwnd, IDC_PRODUCT, CB_ADDSTRING, 0, (LPARAM)"Brood War" );
SendDlgItemMessage( hwnd, IDC_PRODUCT, CB_ADDSTRING, 0, (LPARAM)"Warcraft II" );
SendDlgItemMessage( hwnd, IDC_PRODUCT, CB_ADDSTRING, 0, (LPARAM)"Diablo II" );
SendDlgItemMessage( hwnd, IDC_PRODUCT, CB_ADDSTRING, 0, (LPARAM)"Lord of Destruction" );
SendDlgItemMessage( hwnd, IDC_PRODUCT, CB_ADDSTRING, 0, (LPARAM)"Warcraft III" );
SendDlgItemMessage( hwnd, IDC_PRODUCT, CB_ADDSTRING, 0, (LPARAM)"The Frozen Throne" );[/code]

That's how I set up the product selection CB, and it works fine for me...
December 2, 2004, 3:24 AM
Okee
Thanks Zakath, I wasn't aware of that particular specific send message function.

Although that wasn't my problem apparantly. After messing around out of annoyance I realized it was adding the strings to the combo box. The only way to scroll through them though is by either the arrow keys or the third rolling button on the mouse. Apparantly the drop down part of the combo box isn't comming down when I click the arrow.

Anyone know why this is happening, maybe?
December 2, 2004, 5:25 AM
Zakath
You have to specify how far the box should drop down. How are you creating the dialog? I need to know the method you're using before I can tell you how to fix this.
December 2, 2004, 3:51 PM
Adron
When I'm making a combo box (graphically using some resource editor) I have to first set it to always show the dropped down list and resize the list to as big as I like it to be. Then I can change it to only display when the arrow is clicked, and it will drop down as far as I specified in the first step.
December 2, 2004, 4:41 PM
warz
Or you could alway go in and manually edit the .rc file in WordPad. Look for your combobox and then locate the length and height and change it in there!
December 3, 2004, 2:19 AM

Search