The Sandbox Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Vista Sidebar Gadgets: persistent settings

Back to Forum: The Sandbox
  • User profile image

    Here is a question that seems to pop up with some regularity on the sidebar newsgroup: "Why doesn't the weather gadget remember where I live, if I close it and then add it again to my sidebar?"

    The answer is that every time you add the weather gadget to the sidebar, you are creating a new 'instance' of the gadget; and every instance has its own associated location.  So the newly-added weather gadget has settings that are completely distinct from the settings on the one you closed.  This makes sense when you start to think about having three or five weather gadgets running at the same time - they should each be able to show the weather at a different location.

    Having said that, you may choose to make a different design choice in your gadgets.  Unfortunately, the sidebar does not offer a built-in mechanism for sharing settings between gadget instances.  When asked how to do this by other gadget developers, my first response was: "you can use a shared file to share settings between gadget instances."

    To make life easier for everyone, I decided to write a javascript library that encapsulated that work, and exposed a simple API for reading and writing shared settings.  In the process of writing the library, I discovered that just saying "use a shared file" vastly oversimplifies the effort involved.  *grin*

    Here is the result of my efforts; the attached ZIP file contains a code file persistentSettings.js, and a README.TXT that describes the API.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.