Using PrimalForms with existing script

This forum can be browsed by the general public. Posting is no longer allowed as the product has been discontinued.
Locked
User avatar
geeware
Posts: 2
Joined: Thu Jun 02, 2011 2:34 am

Using PrimalForms with existing script

Post by geeware » Thu Jun 02, 2011 2:34 am

Hi,

First of all, thank you for making such a great soft :)

I have been playing around to see the capabilities of PrimalForm, and decided to add forms to an existing script I made...

So I created two different forms, and export them as ps1 file. I renamed the generated function OnApplicationLoad and OnApplicationExit into Form1-OnApplicationLoad and Form1-OnApplicationExit (same for Form2)

When I include one exported form ps1 (I use dot sourcing) file into an existing script, there is no problem, I call the function Form1-OnApplicationLoad, it does the job, my form load, and I can retrieve the input datas from the user when he click on OK button.

But when I try to import the second exported form ps1, even if I don't call Form2-OnApplicationLoad, the second form is loaded right after the first one is closed...

How can I manage that ? Or if I did something wrong in my work, where did I went wrong ?

Thank you for you answers

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Using PrimalForms with existing script

Post by davidc » Thu Jun 02, 2011 4:40 am

You will also need to rename the GenerateForm function, which contains the code that creates and shows the form. Since the script automatically shows the form, you might want to dot source the file when you need to call the second form (For example when a button is pressed). You don't have to call the OnApplicationLoad function; the script will automatically call this function for you.

Have you tried PrimalForms 2011? It was designed to handle multi-form setups like this and it will make the process much easier and faster.




Thank you for the comments!

David
David
SAPIEN Technologies, Inc.

User avatar
geeware
Posts: 2
Joined: Thu Jun 02, 2011 2:34 am

Using PrimalForms with existing script

Post by geeware » Thu Jun 02, 2011 5:34 am

I'll try this...

I'm already running PrimalForm 2011, but I'm integrating the forms into an existing script, so I don't really want to start from scratch :)

Thanks for your answer, I'll keep you in touch.

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Using PrimalForms with existing script

Post by davidc » Thu Jun 02, 2011 5:56 am

You don't have to start from scratch. Just create a new project and add the original script to the project along with the form files. Then call your script from the Main function in the Startup file (use the Call Functions. I.E. Call-Script_ps1) and let PrimalForms 2011 handle all the merging.

If you need further help with projects please let us know.

David
David
SAPIEN Technologies, Inc.

Locked