Ver Mensaje Individual
  #3  
Antiguo 18-04-2014
feliz-58 feliz-58 is offline
Miembro
 
Registrado: sep 2012
Posts: 314
Reputación: 12
feliz-58 Va por buen camino
Cita:
Empezado por ecfisa Ver Mensaje
Hola feliz-58.

Una opción para dos TComboBox:
Código Delphi [-]
const
  ANIMAL = 0;
  FRUTA  = 1;
  //...
var
  TS1: TStrings;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with ComboBox1 do
  begin
    AddItem('Animales',TObject(ANIMAL));
    AddItem('Frutas',TObject(FRUTA));
    //...
  end;
  TS1:= TStringList.Create;
  TS1.AddObject('Perro',TObject(ANIMAL));
  TS1.AddObject('Manzana',TObject(FRUTA));
  TS1.AddObject('Gato',TObject(ANIMAL));
  TS1.AddObject('Pera',TObject(FRUTA));
  TS1.AddObject('Loro',TObject(ANIMAL));
  TS1.AddObject('Uva',TObject(FRUTA));
  //...
  ComboBox1.Text:= EmptyStr;
  ComboBox2.Text:= EmptyStr;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
var
  i: Integer;
begin
  with ComboBox2 do
  begin
    Items.Clear;
    for i:= 0 to TS1.Count-1 do
      if Integer(TS1.Objects[i]) = Integer(ComboBox1.Items.Objects[ComboBox1.ItemIndex]) then
       Items.Add(TS1[i])
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  TS1.Free;
end;

Saludos
y reconozco tu dedicación a responder en este club Ecfisa, Te felicito, Gracias!

No hay una forma que use bases de datos .-.
Responder Con Cita