Click to See Complete Forum and Search --> : hide and seek


scudsucker
02-19-2003, 05:31 AM
Hi- I am making a desktop calender/event planner, which is loaded by a .jsp into a chromeless window ( thank you, microbians.com! )
As I cannot close or selfclose the .jsp, without an alert box popping up, I have decided to resize the jsp to 100 x 100 and hide it behind its child window.
Is there any way that the child can dynamically control the position of its parent when it ( the child ) is dragged around the stage, so the parent is kept hidden?

Thank you!

gil davis
02-19-2003, 06:23 AM
How about something like this:

<script>
window.resizeTo(200,200);
var myTop = (document.layers) ? window.screenY : window.screenTop;
var myLeft = (document.layers) ? window.screenX : window.screenLeft;

function monitor() {
var currTop = (document.layers) ? window.screenY : window.screenTop;
var currLeft = (document.layers) ? window.screenX : window.screenLeft;
if ((currTop != myTop) || (currLeft != myLeft))
{document.f1.t1.value = currTop;
document.f1.t2.value = currLeft;
myTop = currTop;
myLeft = currLeft;}
}

if (document.layers)
{window.onMove = monitor;}
else
{setInterval("monitor()", 500);}
</script>
<form name="f1">
<input name="t1" type="text"><br>
<input name="t2" type="text">
</form>

scudsucker
02-19-2003, 07:47 AM
Thanks...

But while its nice to have the (x,y) of each window, I don't know how to communicate the child's co-ords to the parent.

My current theory is that I could save the (x,y) of the child in a cookie, and get the parent to read it... but this could be painfully slow.

Any better ideas?

Thanks

p.s. I have seen two windows interacting, at microbians.com (http://microbians.com) in the "Drag across windows" example.

gil davis
02-19-2003, 07:53 AM
I guess your imagination needs a little more help.
<head>
<script>
msg = window.open("", "msg", "top=100,left=100,height=100,width=100");
var myTop = (document.layers) ? msg.screenY : msg.screenTop;
var myLeft = (document.layers) ? msg.screenX : msg.screenLeft;

function monitor() {
var currTop = (document.layers) ? msg.screenY : msg.screenTop;
var currLeft = (document.layers) ? msg.screenX : msg.screenLeft;
if ((currTop != myTop) || (currLeft != myLeft))
{document.f1.t1.value = currTop;
document.f1.t2.value = currLeft;
myTop = currTop;
myLeft = currLeft;}
}

if (document.layers)
{msg.onMove = monitor;}
else
{setInterval("monitor()", 500);}
</script>
</head>
<body>
<form name="f1">
<input name="t1" type="text"><br>
<input name="t2" type="text">
</form>
</body>

scudsucker
02-19-2003, 08:03 AM
Thanks very much, I can take it on from here...

As for my lack of imagination, I am a Flash Designer, and this is my first foray into javascript, trying to break the 100m sprint record before I can walk!

I am trying to impress the C.D. of a company so he will employ me.

Your help is sincerely appreciated.