Einzelnen Beitrag anzeigen

alzaimar
(Moderator)

Registriert seit: 6. Mai 2005
Ort: Berlin
4.956 Beiträge
 
Delphi 2007 Enterprise
 
#7

Re: Den selben Komponenten (fast) gleiche Prozeduren zuweise

  Alt 20. Okt 2008, 20:36
Delphi-Quellcode:
Procedure TForm1.FormCreate (Sender : TComponent);
  Procedure _SetupComboBox (aCombobox : TComboBox; aTag : Integer);
  Begin
    aComboBox.Tag := aTag;
    aComboBox.OnChange := AnyComboBoxChange;
  End;

Begin
  SetupComboBox (ComboBox1, 1);
  SetupComboBox (ComboBox2, 2);
  SetupComboBox (ComboBox3, 3);
  SetupComboBox (ComboBox4, 4);
  SetupComboBox (ComboBox5, 5);
  SetupComboBox (ComboBox6, 6);
  SetupComboBox (ComboBox7, 7);
  SetupComboBox (ComboBox8, 8);
End;

procedure TForm1.AnyComboBoxChange(Sender: TObject);
var
  box: TCombobox;
begin
   box := Sender as TComboBox;
   faecher_loeschen(box.Text, box.Tag);
end;
"Wenn ist das Nunstruck git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput!"
(Monty Python "Joke Warefare")
  Mit Zitat antworten Zitat