Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box !!

Status
Not open for further replies.

Mrtechno

Technical User
Nov 6, 2002
75
0
0
NZ
Hi,

I made 3 combo boxes and what I want to do is that If I select something in the first Combo Box, the second or third Combo Box gets disabled automatically according to the selection in the first Combo Box.

For eg : If I have 2 entries in the First Combo box i.e "Launch an Application" and "Play a Game". If I select "Launch an Application" in the First Combo box, I want that the Third Combo box gets disabled.

I know this is simple but I just can't get it right.

Thanks for your help.
 
>> I know this is simple but I just can't get it right.

can't get what right? please be more specific. Do you have some lines of code that attempt to disable the combobox but don't work? if so post them. do you get a compile error? if so post it.

-pete
 
Hey Pete,

If I select "Launch an Application" in the first Combo box,the second combo box is supposed to stay enabled and the third Combo box is supposed to get disabled but it's not happening.

And if I select "Play a Game" in the first Combo box, the second Combo box is supposed to get disabled and the third Combo box should be enabled.

Sorry for not mentioning this in my first message.

Thanks.
 
Just wanted to add that It's not giving me any errors but it's also not working.

When I execute the program, it shows everything as enabled.
 
Just wanted to add that It's not giving me any errors but it's also not working.

When I execute the program and select any one of the options in the first Combo box, it shows everything as enabled.
 
>> Do you have some lines of code that attempt to disable
>> the combobox but don't work? if so post them.

still waiting...
 
The first Combo Box(IDC_WHATTODO) has a variable m_whtodo.

I declared another variable called whttodo in the initialization function of the main dialog and passed the value in m_whtodo to whttodo.

here's the code :

CString whttodo;

whttodo=m_whtodo;

whttodo.MakeUpper();

if(whttodo=="LAUNCH AN APPLICATION")
{
GetDlgItem(IDC_APPTOLAUNCH)->EnableWindow(TRUE);
GetDlgItem(IDC_GAMETORUN)->EnableWindow(FALSE);
}

Now when I execute this code and select "Launch an Application" in the first Combo box, nothing happens, all the combo boxes are shown as enabled.

I don't know whether I'm doing it right or not. I'm not sure where I'm supposed to write this code. In the Main Dialog or somewhere else.
 
I don't know if I got this right, but is the code you posted in the initialization function?
If so, that'll get called on initialization only!
You should handle the CBN_CLOSEUP event of your comboboxes and check the items there. That will certainly work.
[red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top