• Welcome to Valhalla Legends Archive.
 

Default list of strings in ComboBox

Started by Okee, December 01, 2004, 04:17 PM

Previous topic - Next topic

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)

Zakath

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" );


That's how I set up the product selection CB, and it works fine for me...
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

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?

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.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

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.

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!