Is there an alternative to showModalDialog for Google Spreadsheet? I am willing to learn new software. What software would be reasonable for lightly skilled teacher to learn?
I have a Connect 4 game for my students built in a Google spreadsheet. Random questions are pulled from various tabs with menu items and I want a pretty display of the question. There are dimensions possible in the showModalDialog and HTML. I complicated it by having dimensions in a BODY and a DIV or only in the DIV. The dialog box always has some white showing and the HTML often popups up scroll bars (very ugly). Probably need something more robust than Google App Script to create a clean display of the question. What would anyone suggest?
This is the html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
#parent {
background-color: #99ec46;
/* border: 5px solid #58a30d; /*only shows on top & left sides????? */
/* border-radius: 10px; */
display:table;
font-family:Georgia, Cambria, Times New Roman, Times, serif;
font-size: 100%;
height: 100%;
/* left: 50%; */
margin: auto;
padding: 0;
position: fixed;
text-align:center;
/* top: 50%; */
width: 100%;
}
#child {
/* align-items:center; */
display: table-cell;
/* justify-content:center; */
padding: 55px 55px;
/* transform: translate(-50%, -50%); */
/* z-index: 99999; */
vertical-align: middle;
}
input[type=button], input[type=submit], input[type=reset] {
background-color: #438204;
border: none;
color: white;
padding: 10px 26px;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
}
</style>
</head>
<body>
<div id="parent">
<div id="child">
<?!= nextQuestion ?>
<p></p>
<input type="button" value="Okay!" onclick="google.script.host.close()" />
</div>
</div>
</body>
</html>
This is the code that displays the question. Some questions are long and have html markup to appear on multiple lines (
)./**
* Displays an HTML-service dialog in Google Sheets that contains
*/
function popupNextQ(inQuestion) {
// var html = HtmlService.createHtmlOutputFromFile('Index');
var htmlTemplate = HtmlService.createTemplateFromFile('Next-Question-Popup');
htmlTemplate.nextQuestion = inQuestion;
var html = htmlTemplate.evaluate();
// .setHeight(400)
// .setWidth(600);
SpreadsheetApp.getUi().showModalDialog(html, " ");
}
This is the best I have come up with so far. If I add a border to the html it only appears on the top and left sides. At least with the current dimensions there are no scroll bars for my longest question.
Questions are not vertically aligned so short ones appear toward the top of the green area.
