Add Combo Box to Dialog Box 
Author Message
 Add Combo Box to Dialog Box

Dear all,
I am a beginner of MFC. I wanna ask that if I use the tool pallette of
the dialog resource editor to add the combo box, after clicking on it
and than place it on the dialog resource with the mouse. How can I use
ClassWizard to associate a
variable with the combo box control? For example, if I wanna make a list
of people names, when I choose the name from the combo box, it will
shows the telephone number of him. How can I do so?

Thx~



Sat, 02 Aug 2003 15:40:33 GMT  
 Add Combo Box to Dialog Box

Quote:

> Dear all,
> I am a beginner of MFC. I wanna ask that if I use the tool pallette of
> the dialog resource editor to add the combo box, after clicking on it
> and than place it on the dialog resource with the mouse. How can I use
> ClassWizard to associate a
> variable with the combo box control? For example, if I wanna make a list
> of people names, when I choose the name from the combo box, it will
> shows the telephone number of him. How can I do so?

> Thx~

Ctrl-W brings up class wizard.  Select the Member Variables page and select the
desired control in the ID list.  Then click the "Add Variable" button.  Change
the Category to "Control" and it will add a CComboBox member variable.  If you
name it m_NameCombo then in the dialog's OnInitDialog do

m_NameCombo.AddString(name0);
m_NameCombo.AddString(etc);

--
Scott McPhillips [VC++ MVP]



Sat, 02 Aug 2003 23:30:24 GMT  
 Add Combo Box to Dialog Box
Have you used the tutorials provided with Visual C++? The first tutorial,
called Scribble, probably answers questions like this.


Quote:
> Dear all,
> I am a beginner of MFC. I wanna ask that if I use the tool pallette of
> the dialog resource editor to add the combo box, after clicking on it
> and than place it on the dialog resource with the mouse. How can I use
> ClassWizard to associate a
> variable with the combo box control? For example, if I wanna make a list
> of people names, when I choose the name from the combo box, it will
> shows the telephone number of him. How can I do so?

> Thx~



Sun, 03 Aug 2003 05:30:29 GMT  
 Add Combo Box to Dialog Box
d987498 (or is that 7 or 9?)

In addition to the other replies, if you want to take some action whenever the
user selects a different item in the ComboBox, then add a handler for
CBN_SELCHANGE.  You can use Class Wizard to do that too. Your handler will be
called whenever the user changes selection in the combo box.

Quote:

> ClassWizard to associate a
> variable with the combo box control? For example, if I wanna make a list
> of people names, when I choose the name from the combo box, it will
> shows the telephone number of him. How can I do so?

Jim [VC/MFC MVP]
To send mail, change spam-me-not to msn


Sun, 03 Aug 2003 22:45:48 GMT  
 Add Combo Box to Dialog Box
Check out my essays on my Web site, especially the "dialog box"
series, which contain all sorts of things you will probably find
useful and interesting.
                        joe



Quote:
>Dear all,
>I am a beginner of MFC. I wanna ask that if I use the tool pallette of
>the dialog resource editor to add the combo box, after clicking on it
>and than place it on the dialog resource with the mouse. How can I use
>ClassWizard to associate a
>variable with the combo box control? For example, if I wanna make a list
>of people names, when I choose the name from the combo box, it will
>shows the telephone number of him. How can I do so?

>Thx~

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Sat, 09 Aug 2003 05:09:25 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Add a combo box in a dialog box...

2. Adding combo boxes to dialog at runtime

3. i cannot add an item to my list box that is located within my dialog box

4. List with columns containing both text and combo boxes / check boxes

5. CFindReplaceDialog,search box ->combo box

6. combo box has no list box

7. No dropdown-box in a combo-box possible?

8. graying out edit boxes/combo boxes

9. Combo box in List box

10. scroll combo box added in the c# DataGrid control

11. DBGrid Control adding Combo Box

12. Adding items to combo boxes

 

 
Powered by phpBB® Forum Software