Einzelnen Beitrag anzeigen

Benutzerbild von dataspider
dataspider

Registriert seit: 9. Nov 2003
Ort: 04539 Groitzsch
1.350 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: bessere lösung für prozeduren

  Alt 29. Okt 2011, 07:47
Ich würde hier schon Code in eine Procedure auslagern...
Delphi-Quellcode:
procedure TTblLieferanten.setSearchLabels(m: Byte);
  procedure SetItem(ALabel: TLabel; const ANr: string = ''; const AFunction:
      string = '');
  begin
    ALabel.Visible := True;
    if AFunction <> 'then
      ALabel.Caption := ANr + ' = ' + AFunction;
    if ANr <> 'then
      Combobox2.Items.Add(ANr);
  end;

begin
  combobox2.Clear;
  case m of
    1:
      begin
        SetItem(Label10, '1', 'Name');
        SetItem(Label11, '2', 'Kunden Nr.');
        SetItem(Label13);
        SetItem(Label14);
      end;
    2: ...
  end;
  combobox2.ItemIndex := 0;
end;
Wichtig sind allerdings auch die Hinweise von TiGü...

Frank
Frank Reim
  Mit Zitat antworten Zitat