Autor Beitrag
del1312
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190



BeitragVerfasst: Mi 08.06.05 13:59 
ich schreib grad nen kleine testprogramm wo nach vorheriger eingabe der anzahl, kleine buttons erstellt werden sollen. wie kann man das denn umsetzen? ich weiss nur wie man die buttons per mausklick erstellt, aber nicht per programmierung. könnt ihr mir bitte helfen? dankeschön :)
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 08.06.05 14:05 
das ist gar nicht so schwer:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  button: Tbutton;
begin
  button := TButton.Create(form1);
  button.Parent := form1;
  button.Top := 100;
  button.Left := 100;
  button.Width := 300;
  button.Caption := 'Ich bin im laufenden Betrieb erstellt worden !';

_________________
In the beginning was the word.
And the word was content-type: text/plain.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 08.06.05 14:05 
Mal eben schnell kopiert. Ich hoffe, dass ich nichts übersehen habe.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
var
  ButtonTop : Integer;
begin
    ButtonTop := 3;
    for i := 0 to 9 do begin
      with TButton.Create(self) do begin
        Caption   := 'Button-Nr ' + IntToStr(i);
        Left     := 3;
        parent     := Form1;
        Top     := ButtonTop;
        Width     := 200;
        Height    := 19;
        inc (ButtonTop, 21);
      end;
    end;
end;
del1312 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190



BeitragVerfasst: Mi 08.06.05 14:32 
danke :D
del1312 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190



BeitragVerfasst: Mi 08.06.05 14:48 
äh eine frage hab ich noch. wie kann ich nun die erstellten buttons so versehen das wenn man sie anklickt eine aktion gestartet wird. z.b das sie unsichtbar werden. jeder button kann ruhig die gleiche aktion ausführen.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 08.06.05 14:51 
Hallo!

Du musst den Buttons eine Procedure bei dem OnClick-Event zuweisen. Wie das geht wird u. a. in Christian´s FAQ Beitrag: Komponentenarrays erklärt.

Gruß
Tino