Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Multiform script project - how to call another form in the project?

If I use one of the ide demo's I can create more units/forms. But I only have access to the root if I start the script. How do I access the other form(s) in the project? I used 'use unit2;' this does not generate errors. However unit2.show, form2.show does generate an unknown identifier problem.
Tagged:

Comments

  • 3 Comments sorted by Votes Date Added
  • @Maricca: Link has broken yet and I'm not able to find solution as I have tried same as @aducom tried to call another form in project of IDE demo. Please help, thnx!
  • There are no special about forms, you can add any form to the script as a simple object. For that you have to:

    1) Make sure that the form class is imported. This can be done by importing the form's unit by our Import Wizard.
    2) Add imported unit via ScriptControl.AddUnit.

    After adding the imported unit, all its global declarations, like types, global procedures or functions will be accessible from the script. This includes all global variables; note that, form units usually contains a form global variable.

    ------------------------

    Alternatively, if you want more control about what is exactly imported, you can uncheck the form global variable (Form2), import only the form type (TForm2), and then add the form object manually via ScriptControl.AddObject. This way you can name the form object as you like.


Sign In or Register to comment.