javascript - How to center a PopupPanel -
in web app built in google apps script, want show popup containing som text , links. figured popuppanel way go. i've done:
var app = uiapp.getactiveapplication(); var popup = app.createpopuppanel() .setanimationenabled(true) .setmodal(true) .setglassenabled(true) .setautohideenabled(true); popup.add(app.createlabel('text text text')); popup.setpopupposition(100, 100); popup.setheight('300px'); popup.setwidth('500px'); popup.show();
but instead of setting fixed position, center box in current window. since there seems no such functionality, tried pixel size of window, or form app, or panel sized 100%, can't size anywhere, there seems possible set size.
is there way center popuppanel
, or create popup other way, centered?
i found way of doing want. not beautiful solution, works.
var app = uiapp.getactiveapplication(); var popup = app.createpopuppanel() .setanimationenabled(true) .setmodal(true) .setglassenabled(true) .setautohideenabled(true); popup.add(app.createlabel('text text text')); popup.show(); popup.setstyleattribute('position', 'fixed'); popup.setstyleattribute('top', '100px'); popup.setstyleattribute('left', '25%'); popup.setstyleattribute('width', '50%');
it's important set style attributes after .show()
since call set position: absolute
, top: 0
, left: 0
Comments
Post a Comment