Hi again guys
All I want is t close when I do click in TSpeedButton but I don't know
how to call the click event if the form and the button are created at runtime.
Please, see the below code.
Many thanks for your time and help.
procedure Mainform.Excecute; //This procedure is excecuted by a button and works OK
var
Form: TForm;
begin
Form := TForm.Create(Self); //We create a new form and works OK
with Form do
begin
Left := 350;
Height := 239;
Top := 250;
Width := 411;
BorderIcons := [biSystemMenu];
BorderStyle := bsSingle;
Caption := 'Test';
ClientHeight := 239;
ClientWidth := 411;
Color := 16314859;
Position := poDesktopCenter;
// --------------------------------------
with TSpeedButton.Create(Form) do //A button inside the form.
begin
Parent := Form;
Left := 318;
Height := 27;
Top := 198;
Width := 77;
Caption := 'Close';
OnClick := ???; //How to call a procedure to close the created form at runtime?
end;
// --------------------------------------
end;
end;