Simple popup or dialog box in Google Apps Script

前端 未结 4 1896
情深已故
情深已故 2021-01-12 18:29

I\'m looking for simple code that adds a popup in my Google Apps Script Ui that comes up when I hit a submit button. The popup box would display a message and have a button

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-12 18:50

    Have you tried using zIndex? It places the panel above all of your other panels...

    var popupPanel = app.createVerticalPanel().setId('popupPanel')
        .setVisible(false)      
        .setStyleAttribute('left', x)  
        .setStyleAttribute('top', y)        
        .setStyleAttribute('zIndex', '1')
        .setStyleAttribute('position', 'fixed');
    

    x = panel position from the left portion of your app y = panel position from the top portion of your app zIndex = the 'layer' your panel will appear on. You can stack panels using '1', '2', '3' etc. position = your panel will be in a fixed position denoted by (x,y)

    Visibility is set to false until you click submit, then have a client handler for your submit button make the popupPanel visible. When you click the button on your popupPanel, have the client handler set visibility to false once again and it will disappear.

    One more thing, I noticed you get the active app and then create a new app. You do not need to create a new app...just new panels inside your app.

    Hope this helps!

提交回复
热议问题