簡體   English   中英

Windows 7小工具彈出問題

[英]Windows 7 Gadget Flyout Question

我的彈出廣告遇到了麻煩。 我的小工具會發生什么,您雙擊一個組件,它將有一個相應的彈出窗口。 但是,如果雙擊帶有彈出按鈕的該視覺組件或任何其他可視組件,則彈出文檔將返回null。 我不知道為什么會這樣,如果您使彈出按鈕消失並重新打開它或重新打開它,那沒關系。 僅當彈出按鈕已打開時才會發生這種情況。 我正在尋找一些關於為什么這樣做的想法。

雙擊代碼:

Blah.prototype.ondblclick = function()
{

    var me = this.parent;

    if (System.Gadget.Flyout.show)
    {
        // flyout is already shown, make sure it shows our stuff
        System.Gadget.Flyout.file = FLYOUT_FILE;
        onFlyoutShow();
    }
    else
    {
        System.Gadget.Flyout.file = FLYOUT_FILE;
        System.Gadget.Flyout.onShow = onFlyoutShow;
        System.Gadget.Flyout.show = true;
    }
    System.Gadget.Flyout.onHide = onFlyoutHide;

    function onFlyoutShow()
    {
        me.flyoutOpen = true;
        me.updateFlyout();
    }

    function onFlyoutHide()
    {
        me.flyoutOpen = false;
    }
};

執行的代碼:

Blah.prototype.updateFlyout = function ()
{
    var flyoutDoc = System.Gadget.Flyout.document;
    //flyoutDoc is null at this point
    var info = flyoutDoc.getElementById("info");
    info.innerHTML = "info: " + this.information;
    //Error thrown: 'null' is null or not an object
}

對於Windows 7編寫小工具,我了解不多,但對我來說,這看起來很像是計時問題。 當彈出按鈕已經存在時,您可以更改file屬性,該屬性指示它加載新文件。 不用等待就可以調用onFlyoutShow來嘗試獲取文檔而該文檔尚未加載

  • 我的第一個想法是:設置文件時, onShow事件不會觸發嗎? 可能沒有,或者您可能沒有,但是值得驗證。
  • 如果那不起作用, onFlyoutShow在超時中調用onFlyoutShow 從一個長定時器開始,例如1000。然后將其縮短,希望可以降至0: setTimeout(onFlyoutShow, 0);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM