Archived

This topic is now archived and is closed to further replies.

Matheass

Combo Box

Recommended Posts

Matheass    122
Hello. I wanted to create an DialogBox to setup the graphic. I decided to use a Combo box to set the resolution. I created the DialogBox with Visual C++ and wrote some resolutions to the data of the Combo Box (in the DialogBox Editor). When I run the Program this resolutions aren''t shown (Maybe because my Program is a Win32 API and not a MFC API). I don''t know how to show the text. Thank you for help

Share this post


Link to post
Share on other sites
Vangelis    122
A common problem with Combo Box''s is that the size of the box has to encompass all the possible items in the box. Was this your problem? Might have been something else.

[ vangelis ]

Share this post


Link to post
Share on other sites
Matheass    122
This wasn''t my problem. If I choose Layout->Test in the Dialog-Editor-Menu it works well. But in my Program it works not the same. If I click on the arrow (in my program) the list is shown, but it''s only white, there''s no text in it.

I have Screenshots:

http://make0.piranho.de/images/test.jpg
http://make0.piranho.de/images/programm.jpg

Share this post


Link to post
Share on other sites
SonOfNed    122
Ahhh, mein deutsche freund,

It sounds like you have the same problem I had.
For some reason, using win32, you cannot specify what you get loaded into the combo box at design time, it has to be a runtime thing.
Use the relevent SendDlgItemMessage funtion or its relevent macros:
e.g.

/*The dialog is being initialized*/
case WM_INITDIALOG:
{
/*Add all the options to the combo box*/
char Buffer[64];
strcpy(Buffer,"Question & Answer");
SendDlgItemMessage(hWnd,IDC_ROUNDTYPE,CB_INSERTSTRING,0,(LPARAM)Buffer);
strcpy(Buffer,"Multiple Choice");
SendDlgItemMessage(hWnd,IDC_ROUNDTYPE,CB_INSERTSTRING,1,(LPARAM)Buffer);
strcpy(Buffer,"Image");
SendDlgItemMessage(hWnd,IDC_ROUNDTYPE,CB_INSERTSTRING,2,(LPARAM)Buffer);
}
break;


where IDC_ROUNDYPE is a combobox, Buffer is a string and the wParam bit (i.e. the number) is the index to add the string.

You then read the input like this:

SendDlgItemMessage(hWnd,IDC_ROUNDTYPE,CB_GETCURSEL,0,0)

which will return teh index selected

Hope that helps.

BTW I think the diolog box editor only works with MFC ( i donno, only used MFC twice... )

------


Does it matter? Even if it does matter, does it matter that it matters?

Share this post


Link to post
Share on other sites