简体   繁体   English

Windows小工具调整大小失败

[英]Windows Gadget resize fail

I have a windows gadget that dies when I close a flyout using the following code: 我有一个Windows小工具,当我使用以下代码关闭弹出按钮时,该小工具会死:

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. 原来,System.Gadget声明需要在loaded()函数中。

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. 以前,我只是将它们放在文件的顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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