Problem with Form Loading

I have a form that has many toggle buttons and enabled/disabled text fields that rely on those buttons and calculations going on when the buttons are pressed or information is entered. My problem is that whenever I close the form out, it retains the state of all the buttons that I left it in and all the data that was input into the text fields. Is there a “starting state” for the form that always comes up when the the form is loaded and disregards all previous actions on the form?

  • Caleb

Also, I know I can just set all the values to what I want them to be at the opening of the form but I have around 60 fields that would have to be set. I don’t particularly care for having to go through and set the code for each object.

Hi-

Probably the easiest thing to do would be to set the window’s cache policy to “never”. To do this, select the window, and change the property filter from “Standard” to “All” (the little filter icon- furthest icon on the right- on the “property editor” window). Now you’ll see a “Cache Policy” setting.

This will cause the window to be loaded fresh each time it’s opened. The downside (because there always is one) is that it will be de-serialized each time, which in layman terms means decoded, and thus slower to open. Since you say you have a lot of components, this could actually be fairly annoying, but try it and see.

If that doesn’t work well enough, you could probably loop through and set the component states programmatically on window load. I’m pretty sure the power is there to do this in a fairly concise way, but I don’t have all the information off hand, so reply if you want me to explore this idea a bit more.

Regards,

I turned off the caching and it works perfectly now. I did not see a hit in performance either so I will stick with this method. Thanks!