Unit Hauptform;
interface
uses
InputForm;
type
TMainForm =
class(TForm)
public
procedure OnValuesChanged(Sender: TObject;
const Value1:
string; Value2: Integer);
procedure CallForm2;
end;
implementation
procedure TMainForm.CallForm2;
var
InputForm: TInputForm;
begin
InputForm := TInputForm.Create(self, OnValuesChanged);
InputForm.Show;
end;
end.
Unit ImputForm;
interface
type
TOnValuesChanged =
procedure(Sender: TObject;
const Value1:
string; Value2: Integer)
of object;
TInputForm =
class(TForm)
Edit: TEdit;
Trackbar: TTrackbar;
procedure OnChanged(Sender: TObject);
private
FOnValuesChanged : TOnValuesChanged;
public
constructor Create(AOwner : TComponent; OnValuesChanged: TOnValuesChanged);
reintroduce;
end;
implementation
constructor TInputForm.Create(AOwner : TComponent; OnValuesChanged: TOnValuesChanged);
begin
inherited Create(AOwner);
FOnValuesChanged : OnValuesChanged;
end;
procedure TInputForm.OnChanged(Sender: TObject);
begin
// Statt im OnChanged kann man das sicher auch im OnFormClose aufrufen
if Assigned(FOnValuesChanged)
FOnValuesChanged(self, Edit.Text, Trackbar.Value);
end;
end.