Browser window opening and resizing

Wayne Britcliff
06-06-2002, 05:10 AM
I'm a total novice when it comes to VB as the following basic query will attest to.

I use the following to open a new browser window in IE:

objHelpWin = window.open(myString, "newWin", "width=" & myXValue & ",height=" & myYValue & ",top=20,left=20")

As you can see I'm opening a new window and also passing the size I want it set to (for displaying an image in the newly opened window without embedding it in a htm page).

My problem is that once a new window is open subsequent calls of the same code from the parent window do not resize the spawned window or create another window but place the next image inside the existing window.

Is there any command or way I can cause an additional window to open, auto-close the existing window or even tell the existing window to resize (or is what I am asking just not possible)?

Any help will be much appreciated even if it's just a pointer as to what I can do (although I know it's probably extremely basic stuff for those of you on this forum).

Wayne.

Flyguy
06-06-2002, 05:15 AM
Hmm, this has not that much to do with VB, because you are talking about VBScript. That's why I moved this thread.

The problem you have is because of the name of the window created: "newwin"

If a window with a given name already exists the current window will be openend instead of a new window being created

Wayne Britcliff
06-06-2002, 05:25 AM
My sincere apologies for confusing where to post (I am indeed that new to VB and VBScript - my familiarity is with Lingo and ActionScript at this point).

As for your reply - it does seem terribly obvious - thanks for your patience.

My final query is also a simple one - is at all possible to resize an existing window from another window or does the script have to be inside the window you are trying to resize?

Wayne.

Flyguy
06-06-2002, 05:36 AM
You could try the following functions:

Window.resizeBy()
Window.resizeTo()

To change some other window you have to have the handle of that window.
I don't know whether they work in VBScript, maybe they are just Javascript 1.2 functions.

Wayne Britcliff
06-06-2002, 09:08 AM
The command you suggested (Window.resizeTo()) does indeed work but I can't seem to get it to target another window. The syntax doesn't seem to allow you to target anything other than the window in which the command sits - would that be right? I tried to execute this by varying the name and remembering it as follows:

DIM myString
DIM myXValue
DIM myYValue
DIM tempValue
DIM noExtName
DIM prevNoExtName

myString = Left( swParam, Len( swParam) - 59)
myString = Right( myString , Len(myString) - 15)
noExtName = Left( myString , Len(myString ) - 4)

myXValue= Left( swParam, Len( swParam) - 40)
tempValue=Len( myXValue)
myXValue= Left( swParam, Len( swParam) - 37)
myXValue= Right( myXValue, Len(myXValue) - tempValue)
myXValue= myXValue+20

myYValue= Left( swParam, Len( swParam) - 30)
tempValue=Len( myYValue)
myYValue= Left( swParam, Len( swParam) - 27)
myYValue= Right( myYValue, Len(myYValue) - tempValue)
myYValue= myYValue+30

objImageWin = window.open(myString, noExtName, "width=" & myXValue & ",height=" & myYValue & ",top=20,left=20")
prevNoExtName = window.resizeto(myXValue, myYValue)

prevNoExtName = noExtName

This, however, just causes the parent window to resize.

Varying the name from "newWin" does, of course, cause new windows to be spawned. Thanks.

Wayne.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum