Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What code do i need to open another form from the original

Status
Not open for further replies.

panda69

Programmer
Feb 11, 2002
3
0
0
GB
I am trying to do an about box (form2) and i am having trouble trying to opening form2 from a button click on form1.

Does any 1 have any idea as this and a help file is all i need to finish my progect

if you can help then it would be greatly apreshiated

thanks in advance

John
 
Form2 is an aboutbox so it supposed to be modal, this means the User cannot do other things untill the about box closes.


procedure TForm1.Button1Click(Sender: TObject);
var
Form2: TForm2;
begin
Form2 := TForm2.Create(Application);
try
Form2.ShowModal;
finally
Form2.Free;
end; //try
end;

This creates the form dynamically and free's up memory when it closes.

Another thing to do is to remove your AboutBox form from the auto-create list.

Do this in Project --> Options

Regards
S. van Els
SAvanEls@cq-link.sr
 
remove your about box form from the autocreate list but be sure that u have added the unit of your aboutbox and then do this....

procedure TForm1.Button1Click(Sender: TObject);
begin
form2 := TForm2.create(self);
form2.showmodal;
form2.free;
end;
 
Can't add to the aboutbox thing but, other than I dont see much point in creating a simple aboutbox dynamically!

To write a Help file you will need, Microsoft HTMLHelp workshop which can be downloaded free from the microsoft website (Microsoft giving somthing away!!), There are other (better) Help authoring packages about I dont know of any free ones.
Steve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top