[Project_owners] Apply Options dialog changes

Frank DiLecce frank at supportware.net
Tue Nov 30 12:33:00 EST 2004


----- Original Message -----
*From:* "Chris Means" <cmeans at spatialpoint.com>
*To:* project_owners at mozdev.org
*Sent:* Tuesday, November 30, 2004 12:17:47 PM
*Subject:* [Project_owners] Apply Options dialog changes


>I'm finishing up an extension that updates the status bar with a users'
>current SETI @ Home statistics.
>
>The updating is done through a window.setTimeout.
>
>However, the user has some options about what data is displayed, and how
>often to update them (this is limited to just a few choices so as to not
>overload their servers).
>
>My problem is...after the user has made changes in the options dialog, I'm
>unsure about how to get my main overlay code to reload the users's
>configuration and apply any changes to the display or update frequency.
>
>Currently, I just popup a message and tell the user to force an immediate
>update on the control (by right-clicking).
>
>Any suggestions how best to approach this?
>
>I've tried calling routines in the main code, however, I never seem to get
>the right object references.
>
>Thanks.
>
>-Chris
>  
>
It might not be right but I tend to get the window mediator service and 
iterate through the open windows looking for the window I want, once I 
find it, I then call the update routine on that (window) object

kinda like this...
var wm = 
Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
    var wmEnumerator = wm.getEnumerator(null);
 
    var Wind = wmEnumerator.getNext();
    try{
        if (<condition you write to get the correct window>) {
            Wind.document.defaultView.<your update routine here>;
        }
    } catch(e) {
       // should always have a catch block tho
    }

Good luck

-- 
RTFM first!  Don't wait til all else fails

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20041130/8ef93b1e/attachment.htm


More information about the Project_owners mailing list