简体   繁体   中英

Windows Gadget resize fail

I have a windows gadget that dies when I close a flyout using the following code:

function CheckDockState() {
    System.Gadget.beginTransition();

    var oBody = document.body.style;
    if (System.Gadget.docked) {
        oBody.height = 80;
    } else {
        oBody.height = 800; 
    }
    System.Gadget.endTransition(System.Gadget.TransitionType.morph, timeTransition);
}
function flyoutClose() {
    CheckDockState();
    System.Gadget.Flyout.show = false;
}

Now, this works fine but when I close the flyout - I cannot resize the gadget (using the little "larger version" button)...

Has anyone else had this problem?

Cheers.

Well, I beat you all to it..

Turns out that the System.Gadget declarations need to be in the loaded() function.

eg

function loaded() {  
    System.Gadget.onDock = CheckDockState;
    System.Gadget.onUndock = CheckDockState;
    System.Gadget.settingsUI = "settings.html";
    System.Gadget.onSettingsClosed = SettingsClosed;
    System.Gadget.Flyout.file = "flyout.html";
    CheckDockState();
}

Before, I had them just at the top of the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM