• Welcome to Valhalla Legends Archive.
 

Multiple ComboBox (ComboList)'s on one dialog

Started by Okee, December 04, 2004, 06:07 PM

Previous topic - Next topic

Okee

I have two combobox's on one dialog and I'm processing the CBN_SELCHANGE message inside WM_COMMAND. When I change one combobox, it gets mixed up with my other combobox operations within the same WM_COMMAND. Is there a way to tell which combobox is being switched?

Zakath

The short answer: yes.















The long answer...check the low order word of the wParam (the high order word contains the CBN_SELCHANGE constant).
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

so it might look something similar to:



case WM_COMMAND:
{
           switch((HIWORD)wParam)
            {
                 case IDC_COMBOBOX1:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                        break;
                 case IDC_COMBOBOX2:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                         break;
            }

}



... ? I don't know what to look for within the HIWORD.


Okee

Hmm. MSDN says something about the HWND of the control being in the lParam. I don't seem to be able to do it though. ahhh.

Zakath

You have it backwards. Check the LOWORD(wParam). That will be the constant identifying the combo box.
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

Quote from: Okee on December 04, 2004, 10:15 PM
so it might look something similar to:



case WM_COMMAND:
{
           switch((HIWORD)wParam)
            {
                 case IDC_COMBOBOX1:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                        break;
                 case IDC_COMBOBOX2:
                        switch((LOWORD)wParam)
                        {
                                  case CBN_SELCHANGE:
                                   break;
                        }
                         break;
            }

}



... ? I don't know what to look for within the HIWORD.

Once again, I tried something similar to this method. I'm not quite sure where to check within the loword. Will I just be looking for the name of the combobox? I'm confused still, and it has been a week or so. :-(

Zakath

#7
What are the resource constants defined for the combo boxes? IDC_COMBOBOX1 and IDC_COMBOBOX2?

If so, do something like this:


case WM_COMMAND:
switch( HIWORD(wParam) ) {
case CBNSELCHANGE:
switch( LOWORD(wParam) ) {
case IDC_COMBOBOX1:
doStuff();
break;
case IDC_COMBOBOX2:
doOtherStuff();
break;
default:
break;
}
break;
default:
break;
}
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