I’m trying to setup my solution so it doesn’t load a form on startup since I have a global method set in the onOpen event to dynamically create a form using the SolutionModel API. I’ve set the firstForm property to -none- but it’s still loading the first form in my Solution. How do I prevent Servoy from loading a form on startup?? This is using Servoy v4.1.0 and the smart client.
The problem isn’t in getting my dynamic form to display. The problem is that Servoy is trying to load another form in my Solution first even though I thought I’d disabled that behaviour by setting the firstForm property to -none-. This is very inefficient in my case because the form it’s loading is slow to load so I’m trying to avoid the unnecessary overhead and extra load on the database.
I tried a little sample in which I create and show a form in the solution.onLoad method.
This overrides the solution.firstForm property completely, the firstForm is never loaded or shown.
I figured out my problem… it was a pilot error on my part. When I was launching the solution (from within Servoy Eclipse) I had the form selected rather than the solution so I guess that bypasses the normal event loading of the solution.
I have discovered there may be a bug after all. Or at least it’s not desirable behaviour in my case. What I’ve discovered is actually happening is if the method registered in the onOpen event ends up erroring for some reason then Servoy decides to go ahead and load the first form in the Solution. So what ends up happening when using the Smart Client is that my method is called, it errors, then Servoy loads the first form in my solution and then after that loads it pops up an error dialog with the error from my onOpen method. In Web Client what happens is the first form gets loaded with no errors indicated to the user.
This seems like a bug to me. If my onOpen method errors Servoy should popup the error dialog immediately and shouldn’t be trying to load another form against my wishes.
Servoy will always need to show a form.
If your solution onOpen method creates a form to show and that fails, then servoy wil revert to the first form.
What you can do is create an error-form (empty form with an error message on it) and make that the first form.
If all goes well ,it never shows, if something fails at solution.onLoad the error message is shown.