2013-02-26 90 views
3

我有這樣的代碼,創建一個裝飾彈出面板:如何添加樣式到decoratedPopupPanel?

... 
    var x = 600; 
    var y = 150+row*23; 
    var popPanel = app.createDecoratedPopupPanel().setStyleAttributes({background:'#FFFFDD',padding:'15px'}); 
    var message = app.createHTML("Opération non reversible !!<BR>Il faudra 'rafraichir' votre navigateur<BR>"+ 
    "après vous être effacé du planning (case ✖)<BR>pour voir les données à jour").setPixelSize(300,60).setStyleAttributes({background:'#FFFFDD',padding:'15px'}); 
    popPanel.add(message); 
    popPanel.setAnimationEnabled(true); 
    popPanel.setPopupPosition(x, y); 
    popPanel.setAutoHideEnabled(true); 
    popPanel.show();// I didn't chain the commands to make it easier to test by commenting one or another... 
return app; 
} 

,並給出了這個結果:

enter image description here

我的問題是:明知背景屬性決定了周邊區(彈出面板填充15px),並且內部小部件也有其背景色(以及它自己的填充),如何更改此藍色框的顏色?

+0

我也想知道這一點(當使用裝飾的標籤面板)。我認爲這是不可能的。我使用Chrome檢查器,發現藍色部分實際上是一組圖像。所以它不會是一個簡單的CSS修復。我還在尋找解決方案時發現[此主題](http://productforums.google.com/forum/#!topic/apps-script/pGMGc7rC6QA)。 – 2013-02-26 21:16:16

+0

感謝您的鏈接,我沒有找到一個......其中一個答案(James Ferreira)使用'borderRadius'將我帶到解決方案...所以請隨時將您的評論升級到答案,以便我可以接受它;)我將發佈我的新代碼作爲第二個答案。 – 2013-02-26 22:11:43

回答

1

看來,裝飾**不能在GAS重新裝修。我也想知道這一點(當使用裝飾性的標籤面板時)。我認爲這是不可能的。我使用Chrome檢查器,發現藍色部分實際上是一組圖像。所以它不會是一個簡單的CSS修復。

This thread似乎有最後的判決。

+0

謝謝,我發佈了下面的完整代碼。 – 2013-02-26 22:49:41

1

感謝來自對方的回答(導致James Ferreira's site)我是能夠建立這個新的代碼,是一個很大的易於定製的鏈接...

這與下面的結果:

... 
    var x = 600; 
    var y = 150+row*23; 
    var popPanel = app.createPopupPanel().setStyleAttributes({background:'#ccccaa',padding:'5px', borderRadius:'15px 15px 15px 15px',borderColor:'#ffffdd',borderWidth:'5px'}); 
    var message = app.createHTML("Opération non reversible !!<BR>Il faudra 'rafraichir' votre navigateur<BR>"+ 
    "après vous être effacé du planning (case ✖)<BR>pour voir les données à jour").setPixelSize(300,60).setStyleAttributes({padding:'5px'}); 
    popPanel.add(message); popPanel.setAnimationEnabled(true).setPopupPosition(x, y).setAutoHideEnabled(true).show(); 
return app; 
} 

enter image description here

borderRadius:'px px px px'可以在任何插件一起使用,從而允許很好的按鈕爲WEL ;-)

enter image description here

+0

不要忘記[瀏覽器支持](http://caniuse.com/border-radius)。看起來每個人都可以做到這一點,除了老版本的IE瀏覽器。 – 2013-02-26 22:52:17

+0

好的,但我沒有辦法在IE上測試它,我在Mac和Android上,它在我在兩個平臺上測試過的每個瀏覽器上都能很好地工作......(Chrome,firefox,Safari和Android4標準瀏覽器)...... – 2013-02-26 22:55:31