Hey.
1st of all: Excuse my poor english skills.
I'm currently working on a small programm which shall create a form with objects, as buttons, while runtime.
The big problem for me is: I don't know how to declare the objects, which became create while running the executable.
E.G.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
{TForm2}
Tform2=class(TForm)
Form2Button:TButton;
//
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
Form2:TForm1;
Form2Button: TButton;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2:= TForm.Create(nil);
Form2.Width:=219;
Form2.Height:=373;
Form2.Top:=223;
Form2.Left:=110;
Form2.Caption:='Format ändern';
Form2Button:=TBUtton.Create(form2);
Form2ButtonQuelle.parent:=form2;
Form2Button.Caption:='Form2Button';
Form2Button.Top:=157;
Form2Button.Left:=16;
Form2Button.Height:=24;
Form2Button.Width:=90;
Form2.Show;
Form1.visible:=false;
end;
{TForm2}
//At this place i want to call a procedure which starts, if somebody clicks Form2Button. + In real i have problems with the declaration of //TForm2 too, because it doesn't becomes created at the programs start. (just added this here to make my plan hopefully more //understandable)
end.
I'm already excited to see a solution.
Ty all for the time, you spend to help.