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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Forms 1

Status
Not open for further replies.

Charliec2uk

Programmer
Jan 21, 2005
6
GB
I am having some difficulty with writing a multiple form application. Basically, what I would like to achieve is to be able to click a button on my base form, another form to become visable, which I could then edit some timing characteristics. Then click okay or whatever, which would let me pass my inputs to the main programme, and then close the spawned form. Any help would be most welcome.
 
Make the forms as you please.

When you click the buttor "show form 2" do:
Form2->Show();
or if Form2 is to be closed before you can continue on Form1 (mainform) use:
Form2->ShowModal();

To "close" Form2 let it's "ModalResult" (Form2->ModalResult) equal true....or was it false? Check in help.

I.e. Form2->ModalResult = true; // Shuts down form and transfer control to Form1

Check help om 'ShowModal'.

Totte
Keep making it perfect and it will end up broken.
 
Don't forget to add header files if you want forms to communicate (ie. be able to Show() and Close() each other).
If Form1 is defined in Unit1.h and Form2 in Unit2.h just include Unit2.h in Unit1.cpp, and Unit1.h in Unit2.cpp.

Michael
 
you can also read the various properties of the
popup form after it is closed.

from the popup

void __fastcall TPopUpForm::CancelButtonClick(TObject *Sender)
{

OkButton->Tag = 0;
CancelButton->Tag = 1;
Close ();
}


form the calling form

if (PopUpForm->CancelButton->Tag == 1)
do this
else if (PopUpForm->OkButton->Tag == 1)
do this

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top