当前位置: 动力学知识库 > 问答 > 编程问答 >

google apps script - How to add style to decoratedPopupPanel?

问题描述:

I have this code that creates a decorated popup panel :

 ...

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;

}

and it gives this result :

My question is : knowing that background attribute determines the surrounding zone (popup panel padding 15px) and that the inside widget has also its background color (and its own padding as well), how can I change the color of this blue frame ?

网友答案:

It seems that decorated** can not be redecorated in GAS. I too have wondered this (when working with decorated tab panels). I concluded that it was not possible. I used the Chrome inspector and found out that the blue part is actually a set of images. So it wouldn't be a simple CSS fix.

This thread seems to have the final verdict.

网友答案:

Thanks to the link from the other answer (leading to James Ferreira's site) I was able to build this new code that is a lot more easy to customize...

Here it is with the result below :

  ...
  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;
}

The borderRadius:'px px px px' can be used on any widget, allowing for nice buttons as wel ;-)

分享给朋友:
您可能感兴趣的文章:
随机阅读: