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

Opening a form from inside another one.

Status
Not open for further replies.

Mully

MIS
Aug 22, 2002
14
US
Hi There,

This will probably be easy for you!

Bit new to Delphi so bear with me. I am trying to open a form I have created from within a large program that has already been set up. Ideally I would like the form to sit on top and hold the focus of the project until the OK i.e. close button is clicked. What is the best way to do this really I am having problems just getting the new form to open from within the other form.

Thanks for the help

Mully
 
Say you have a button on the main form, and the form you want to open is called newform...
In the button's on-click event, you can put the following...

newform.show;

If you'll be returning a value from the newform to the mainform (like using newform as a lookup for the main form), you can do something like this...

if newform.showmodal = mrOK then...

To use that method, you would need newform to have an OK button that returned a modal mrOK value when clicked.
 
Thanks for that,

Unfortunately the form we wish to call the other one from will be open and running tests so we really wanted to be able to insert the call to open the new form between some of the lines of the existing test code, it is used to demonstrate some awkward connections that need to be made on the test equipment, however we don't want the main test code to carry on until the new form has been closed using the okay button.

Cheers
Mully
 
Just use the second method I listed then...
use...
if newform.showmodal = mrOK then...
in your test code. should work...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top