Gadget works first time, corrupted on reload.

I have made a complex (sort of) gadget program for myself.

I am having a problem with loading the gadget.

After export it works fine, then after closing it, and then reloading it, mouse over states (no image displayed for an object) and various scripts etc just dont seem to be there.

Closing and reopening the problem remains.

Repackaging the gadget maks it works ONCE again.

There are no persistent variables and I have tried using persist and no persist object states option while making the gadget.

Any ideas?
4,283 views 2 replies
Reply #1 Top
I've seen similar behavior. Not sure of the cause.

Do you mean by "no persistent variables" that you are using neither Object.LocalStorage, Object.PersistStorage, nor Widget.Preferences? I know LocalStorage just doesn't take with gadgets, never tried PersistStorage. The Widget.Preferences can also be corrupted in memory and even in the preferences.xml file if you create, check and adjust multiple Widget.Preferences in a single subroutine.

But, if you aren't using those, then that's no help.

Another thing I have experienced from time to time is a conflict in loading where certain scripts reference other scripts, which haven't yet loaded themselves. The funny thing is that these conflicts often aren't apparent as one works on their project. It is only when the widget or dxpack is imported that the issue arises. Also sometimes a widget will alert of "not enabled" scripts on execution also, if this is the problem. Try exporting as a widget or dxpack, then create a new, empty desktop, and then load the exported package as the end user might (double click or import). If any alerts pop up about referencing scripts not yet enabled, then this is happening when the gadget is run, but the gadget is not equipped to show those alerts.

I have found that I can usually resolve these script reference conflicts by streamlining my code or finding another way for scripts to know or do what it is that was causing the problem.

If you delete the Gadget cache between executions, does the gadget work on reload?

So, just some suggestions. I can tell you that I have experienced this very thing; mouse-over states losing their settings (including image apparently) and things simply not responding (after having worked swimmingly the first time). Sometimes I give up on exporting as a gadget, other times I rework it until it doesn't do it anymore (for whatever unknown reason). I love DX, but debugging Gadgets is no fun.

Good luck, let us know if you find a solution, please!
Reply #2 Top
I identified the problem. When th gadget was closed, I assume DX takes over and does some cache cleaning etc of it's own. I was attempting to run the gadget again before this 'finishing' procedure had completed.

If I closed, waited a few more seconds, then reopened, there was no problems.

Thanks for your suggestions.