Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Frames and preference panels



Hello,

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:

<frameset rows= "100, *" border=0 frameborder=0 framespacing=0>
<frame name="control" src="control.html" scrolling="no" noresize onload="buildDateList()">
<frame name="listing" src="listing.html">


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

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.