Autor Beitrag
rob87
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 461

Win Me, Win XP Home, Win XP Prof
Delphi 2007 Enterprise
BeitragVerfasst: Fr 07.09.07 13:13 
Hallo,

ich wollt mal fragen, ob man Befehle wie Enabled, Visible, etc. zusammenfassen kann.

Bsw. Button1.Enabled := true;
Button2.Enabled := true;
Panelxy.Visible := false;

Das ich des irgendwo festleg und dann nur noch sag, führe "UmfassenderBefehl1" aus. GEht sowas??
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Fr 07.09.07 13:33 
Ja.
Das sind alles Elemente einer Form (z.B. TForm1). Dort kannst Du eigene Methoden ("Prozeduren" und "Funktionen") definieren, wo Du diese Dinge zusammenfasst. Dann musst Du nur noch die Methode aufrufen (UmfassenderBefehl).
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 07.09.07 14:13 
Ansonsten gibts auch noch die Möglichkeit mit FindComponent z.B. etwas mit Button1 bis Button10 zu machen:
ausblenden Delphi-Quelltext
1:
2:
for i := 1 to 10 do
  TButton(FindComponent('Button' + IntToStr(i))).Enabled := False;

Falls du sowas meintest ;-).
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Fr 07.09.07 14:16 
Ist die Frage, gibtes nur 2 Möglichkeiten (also an/aus) oder mehrere??

Ansonsten wie mein Vorredner bereits sagte (Bsp: 2 Möglichkeiten)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Flip(const AWas: Boolean);
begin
  Button1.Enabled := AWas;
  Button2.Enabled := AWas;
  Panelxy.Visible := not AWas;
end;
alles in Proc auslagern und aufrufen!

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!