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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help needed with combobox 1

Status
Not open for further replies.

INDO

Programmer
Mar 18, 2001
12
US
I am trying to create a form with 3 shapes and each shape is chosen from a combo box and in turn is displayed on the form with the other shapes not visible. What is the best way to accomplish this. Where do I place the code and what properties do I use? just a push in the right direction would be great.

Many thanks
Indo
 
I think you should create a separate window what do it and make it as the dialogs child. The chapes you'll draw in WM_PAINT handler. John Fill
1c.bmp


ivfmd@mail.md
 
naw, try this. i'll assume your combobox name is ComboBox1
the three shapes i have are as follows:
Square
Circle
RoundedSquare

i set my ComboBox Style property to csDropDownList, and i have 3 items in the box (in order):
Square
Circle
Rounded Square

here is the code that i have in the OnChange event:

//----------------------------------------------------------
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{

switch(ComboBox1->ItemIndex)
/*grabs the designated numbers for each item*/
{
case 0:
Square->Visible = true;
Circle->Visible = false;
RoundedSquare->Visible = false;
break;
case 1:
Square->Visible = false;
Circle->Visible = true;
RoundedSquare->Visible = false;
break;
case 2:
Square->Visible = false;
Circle->Visible = false;
RoundedSquare->Visible = true;
break;
}

}
//----------------------------------------------------------

that will make it so that every time the user clicks on an item, the code for that item will be carried out Cyprus
 
Thanks a lot cyprus.

you saved the day.

INDO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top