Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey TCP,

So I want to make an application where I use a combo box for the user to choose various conversion options. I don't know how it works or what to code when the user clicks an option and then button's show up to convert. Anyone have a specific tutorial on this or how I can get started on the first one? I've looked through about 5 tutorials and all they tell me are functions but not exactly pertaining to what I'm trying to do.

(or do combo boxes not apply to my situation..?)

Thanks in advance.

Picture provided.

Posted
Updated 1-Nov-10 12:31pm
v2

1 solution

Add a handler for the CBN_SELCHANGE event. You can do this via the designer. Select your combobox, and select the Control Events tab in the Properties panel, and choose CBN_SELCHANGE. The auto-added handler will look like this:

C++
void CYourDlg::OnCbnSelchangeCombo1()
{
    int sel = m_combobox.GetCurSel(); // code to add
}


The variable sel will be the 0 based index of the user's selection
 
Share this answer
 
Comments
Paul Camantigue 1-Nov-10 18:57pm    
Thanks for your reply, but what do I do from there? Is it possible for me to show different buttons when a different selection is met?
Nish Nishant 1-Nov-10 20:10pm    
Why show different buttons? Show the same button, but just change its text based on what the user selected.
«_Superman_» 1-Nov-10 20:12pm    
I presume you want to show different text based on the selection.
For this you can change the text on the controls using SetWindowText.
To show entirely different control based on the selection, you could hide irrelevant controls and show relevant ones using ShowWindow.
You can also create controls dynamically using CreateWindow, but that is not recommended.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900