Focal Point
[SHARING] App Studio - Resize & Center HTML Page

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7547013876

September 09, 2015, 08:08 AM
Squatch
[SHARING] App Studio - Resize & Center HTML Page
You can make an HTML page resize and center on your screen by using App Studio and some JavaScript.

In App Studio, go to the "Embedded JavaScript/CSS" tab, and add the following six lines you see under "function window_onload() {":

//Begin function window_onload
function window_onload() {

var windowWidth = 530;
var windowHeight = 660;
var xPos = (screen.width/2) - (windowWidth/2);
var yPos = (screen.height/2) - (windowHeight/2);
window.moveTo(xPos, yPos);
window.resizeTo(windowWidth, windowHeight);

UpdateData();

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload


You will need to adjust the window width & height lines of code to match your HTML page size. This works when your HTML page is run after signing in to the WebFOCUS BI portal.

I did not find anything like this searching this forum, so I thought I'd post this in the hope that it will be useful to others.

This message has been edited. Last edited by: <Kathryn Henning>,
September 09, 2015, 11:45 AM
Barry Solomon
Hi Squatch

Try the following:

var scrWidth=screen.width;
var grpbxWidth = document.getElementById('groupbox1').offsetWidth;
var setWidth = ((scrWidth - grpbxWidth)/2);
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);
document.getElementById('groupbox1').style.left = setWidth + "px";

You will want to modify this code for your own purposes.

Thanks Barry


WebFOCUS 8
Windows, All Outputs
September 09, 2015, 12:15 PM
capples
I've used similar code in my HTML forms to get them to take up most of the screen. You can also use this in fex files at the end to get them to run full-screen as well.

I subtracted 40 pixels off the height to account for the taskbar on most machines. Just another thought.

-HTMLFORM BEGIN


<script language="JavaScript">
window.moveTo(0, 0);
window.resizeTo(screen.width - 1, screen.height - 40)



-HTMLFORM END


WF 8.2.0.3
Windows 10 64bit
HTML, AHTML, PDF, Excel
September 09, 2015, 12:52 PM
Squatch
Thanks Barry and capples, I'll file your suggestions for future use!


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs