[thelist] Minimising the window and IE pop up windows

Keith cache at dowebs.com
Thu Jan 24 14:25:00 CST 2002


> paul,

> > Another quick question, is there anyway to have an
> > onclick minimise this window?
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

jeff

> no.  the closest you'll get is the blur() method with no reliable way
> move it behind another window except to call the blur() method on the
> popup from another window as well as calling the focus() method for
> the window you want to cover the popup with.

That's what I thought until I moved the chromeless pop-up to an hta.
In that environment it's entirely poassible that the pop-up will be the
only application open and so there's nothing else to hide it behind.
That's when I found out that you can do a very convincing "minimize"
even without hiding it behind something else. You move it off the
screen with something like

function minimize(){
window.blur()
moveTo(2000,2000)
}

The trick is getting it back. To reposition where it left from you have
to capture screenwise where the "minimize" click took place, and
know where on your window's width and height that point is. (this
will not work if you allow your window to be resized to unknown
dimensions)

First create two global vars
var screen_x
var screen_y
then set two global vars equal to the x/y coordinates of the center of
the minimize button on your window
button_x = 338
button_y = 20
and set a global tracking var to off
show=0

Then onclick to minimize and capture the click's location while
moving and blurring the window, also changing the tracking var to
on.

function minimize(){
screen_x=event.screenX
screen_y=event.screenY
window.blur()
moveTo(2000,2000)
show=1
}

To restore the window the user clicks the window icon in the
taskbar bringing focus to the window. With a
<body  onfocus=reshow()

call the function and move the window back to screen_x minus
button_x and screen_y minus button_y, and turn the tracker back off.

function reshow(){
if(show==1){
moveTo((screen_x-button_x),screen_y-button_y)
show=0
}}

I've left out any browser compatability tests in the above since my
purpose served an hta that requires IE4+. I have used this on a
chromeless as well as the hta with good results

keith



More information about the thelist mailing list