I am in the process of writing my first widget and I'm having some
problems getting the preferences transition to work properly. The
main view of my widget consists of a file called main.html which
contains the following frameset definition:
Which creates two frames- one to hold my control panel for the widget
stored in an HTML file called control.html and one which points to a
temporary HTML file to be replaced with a dynamically generated
function. The buildDateList() function (which is declared in a .js
file) populates a select element in the control.html file and also
calls a function that generates the content for the listing frame.
At present, when switching to the preferences, I use the following code:
function showPrefs() {
if (top.window.widget)
widget.prepareForTransition("ToBack");
top.control.location= "prefs_top.html";
top.listing.location= "prefs_bottom.html";
if (top.window.widget)
setTimeout ('widget.performTransition();', 1000);
}
This allows me to completely replace the contents of the widget with
the two HTML files that hold the preferences display. However, I
have a problem when switching back. The following code is intended
to reload the original HTML files back...
function hidePrefs() {
if (top.window.widget)
widget.prepareForTransition("ToFront");
top.control.location= "control.html";
window.location= "listing.html";
if (top.window.widget)
setTimeout ('widget.performTransition();', 1000);
}
However, all it seems to do is refresh the current contents of the
frames, instead of restoring them to their (non-preference pane)
contents. Basically, what I want to do is either find a way to
reload the original HTML files back into the frames again, or a way
to get rid of the frames and then restore them when leaving the
preferences panes. Safari gives the the following JavaScript error:
Undefined value
undefined
Line: 0
So there's something wrong with my code, but I'm not sure what...
Thanks in advance,
Daniel.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden