Autor Beitrag
Weide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Do 29.04.04 18:40 
Hallo,

ich muß mehrere Procedureteile schreiben, die zwar verschiedene Objekte(?) ansteuern, aber letztendlich die gleichen Aufgaben bewältigen.


Ein Beispiel:

1. Procedure:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
      ComboDatumAlphabet.Assign(ComboBoxDatum.Items);
      ComboBoxDatum.Text  := '';
      DatumIndex := -1;
      EditDatum.Enabled := false;
      CheckBoxDatum.Checked := true


2. Procedure:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
      ComboUhrzeitAlphabet.Assign(ComboBoxUhrzeit.Items);
      ComboBoxUhrzeit.Text  := '';
      UhrzeitIndex := -1;
      EditUhrzeit.Enabled := false;
      CheckBoxUhrzeit.Checked := true



Im Prinzip unterscheiden sich die Proceduren nur durch den Bezeichner "Datum" bzw. Uhrzeit. Besteht hier die Möglichkeit einer Vereinfachung?

Danke im Voraus

Gruß Weide

Moderiert von user profile iconPeter Lustig (20:16, 29.04.2004): Code- durch Delphi-Tags ersetzt
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Do 29.04.04 19:10 
Titel: hmm,
übergib einfach die Komponente als Parameter und dann kannste sie in einer Procedure bearbeiten.

_________________
mfg. Joel
Weide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Do 29.04.04 19:33 
Hallo Joel,

vielen Dank für Deine Antwort. Leider verstehe ich nicht genau, was Du meinst. Kannst Du es eventuell etwas ausführlicher erläutern?

Gruß Weide
Benedikt
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 29.04.04 19:57 
Hi,

JoelH meint wahrscheinlich, das du dir eine Prozedur erstellen sollst, die du dann einfach mit den verschiedenen Parametern aufrufst, z.B.:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
//Prozedur
procedure TuDieses(AComboBox: TComboBox; ACheckBox: TCheckBox; AEdit: TEdit);
begin
      ComboDatumAlphabet.Assign(AComboBox.Items); 
      AComboBox.Text  := ''; 
      DatumIndex := -1; 
      AEdit.Enabled := false; 
      ACheckBox.Checked := true
end;

//Aufruf
TuDieses(ComboBoxDatum, CheckBoxDatum, EditDatum);
TuDieses(ComboBoxUhrzeit, CheckBoxUhrzeit, EditUhrzeit);
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Do 29.04.04 20:35 
Titel: hmm,
genau so hab ich das gemeint, ja.

_________________
mfg. Joel
Weide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: Do 29.04.04 22:01 
Hallo,

ach soo, das ist ja recht einfach, vielen Dank :-)

Gruß Weide