Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resizeTo causing flashing in hta

Status
Not open for further replies.

xwb

Programmer
Jul 11, 2002
6,828
GB
Here is a simple application. What I want to do is to set the size to 300x200 when the program loads up. The problem is when it starts up, it flashes. Is there a different way of sizing the form so that it does not flash?
Code:
<html>
<head>
<title>Load Size</title>
<HTA:APPLICATION
     APPLICATIONNAME="Load Size"
     BORDER="thick"
     CAPTION="yes"
     MAXIMIZEBUTTON="yes"
     MINIMIZEBUTTON="yes"
     SCROLL="no"
     SHOWINTASKBAR="yes"
     SINGLEINSTANCE="yes"
     SYSMENU="yes"
     WINDOWSTATE="normal"
>
</head>
<body language="vbscript" onload="resizeTo 300,200">
</body>
</html>
 
After 3 hours of googling (what a way to spend a Sunday afternoon) - I found the answer by experimenting. It is strange that nobody has even mentioned this.

It is basically the order in which the HTML is excuted. When it executes WINDOWSTATE=normal, it sets the window size. It then gets to body which resizes, hence the flashing. If we don't want it to flash or show a window of the wrong size, the resize has to be done before the HTA statement.
Code:
<html>
<head>
<title>Load Size</title>
<script language="vbscript">
   resizeTo 300,200
</script>
<HTA:APPLICATION
     APPLICATIONNAME="Load Size"
     BORDER="thick"
     CAPTION="yes"
     MAXIMIZEBUTTON="no"
     MINIMIZEBUTTON="yes"
     SCROLL="no"
     SHOWINTASKBAR="yes"
     SINGLEINSTANCE="yes"
     SYSMENU="yes"
     WINDOWSTATE="normal"
     />
</head>
<body>
	Hello
</body>
</html>
 
Or you could try:

Code:
<script language="vbscript">
sub window_onload
   window.resizeTo 300,200
end sub
</script>


strebor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top