
October 14th, 2007, 11:14 AM
|
Registered User
|
|
Join Date: Oct 2007
Posts: 1
Time spent in forums: 3 m 41 sec
Reputation Power: 0
|
|
How to return to previous form(not main) ?
i'm quite new to delphi and theres something about its form i don't quite get it yet, i hope someone will be able to help me out. I'll put it with a simple example :
1. have 3 forms with a button each. Only the first form is auto created.
2. 1st form (main) will show 2nd form, and the 2nd form
will show the 3rd.
3. 3rd form will need to return to middle form, that's when i get access violation error.
-------------------
[code]
//main form will contain :
procedure TfrmMain.Button1Click(Sender: TObject);
var
f:TfrmSecond;
begin
f := TfrmSecond.Create(nil);
try
f.ShowModal;
finally
f.Release;
end;
end;
//second form also contains :
var
f:TfrmThird;
begin
f := TfrmThird.Create(nil);
try
f.ShowModal;
finally
f.Release;
end;
end;
//third form contains :
procedure TfrmThird.Button1Click(Sender: TObject);
var
f:TfrmSecond;
begin
try
f.ShowModal;
finally
f.Release;
end;
end;
[\code]
|