PDA

View Full Version : Close event DHTML window interferes with DHTML tooltip II?



Emile
06-18-2007, 08:21 AM
1) Script Title: DHTML window

2) Script URL (on DD):
- http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/
- http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip2.htm

3) Describe problem:
When the script is used in combination with the DHTML Tooltip II script a problem occures when someone use the close button on the DHTML window. This wont occure if the hide event is used.
For some reason this close event clears the DHTML Tooltip II (they wont popup anymore)
Is it possible to add a hide event to this close button instead?

Regards,

Emile

Emile
06-18-2007, 09:10 AM
More information:

The same problem occures when you drag the window.
If you drag the DHTML window the DTHML tooltip stops working.
These are the tooltips on the underlying window so not tooltips you use in the DHTML window.

ddadmin
06-18-2007, 08:58 PM
Please post a link to the page on your site that contains the problematic script so we can check it out.

Emile
06-19-2007, 06:24 AM
Hopefully you will have a bit of understanding dutch.

You can find the website here: http://www.koster.nl/reken/generali/generali.asp

You have to check the checkbox with the label "Inboedelverzekering"

Here you will see small icons with an "i" on it and you can hoover over them for the DHTML Tooltip II (those tooltips are really great, I even store complete tables in those and show pictures).

If you use the button with the label "Klik voor rekenhulp" you will get the DHTML Window.

Now 2 items will trigger that the popups wont work anymore and that is the close icon on the DHTML Window and if you drag the DHTML Window.
If you use the normal buttons (which call the hide function) the icons will still work when you return to the main window.

So for test purpose first try the normal buttons which call the hide function and you will notice that the DHTML Tooltips still work.
After that try the drag and/or closebutton (right top corner of DHTML Window) and you will see that the icons stopped working.
I even don't get a JavaScript error (or at least my debugger wont show anything wrong).
The rest of my JavaScripts are still working properly.

Hope this will provide enough information for your investigation.


Regards,

Emile

Emile
06-19-2007, 07:11 AM
I found something interesting which explains the drag and close problem.

The DHTL Tooltip event -> document.onmousemove=positiontip is replaced with the DHTML Window event when dragging the DHTML Window.
Further the document.onmousemove is set to null in the stop function (which also is triggered by the close button).

Is there a possebility to store a previous set onmousemove event so this one can be restored when you leave the DHTML Window?

My temporary fix for the drag problem is resetting the DHTML Tooltip onmousemove event in the onclose function (in my script not the dhtlwindow.js) of the DHTML Window.
This still doesn't fix the close button problem as that one is not triggering the onclose function.

Emile
06-19-2007, 07:24 AM
Testing further.

I also used DHTML Tooltips in the same DHTML Window (mind here that even without use of DHTML Tooltips in this window the problem on the underlying window occures).
When I drag the DHTML Window for some reason these tooltips still work properly, even as the stop function is called every time you stop dragging which set onmousemove event to null.

ddadmin
06-19-2007, 08:21 AM
I'm going to take a closer look at this later today (it's very late now). :)

ddadmin
06-21-2007, 06:16 AM
Sorry for the delay in response. This may or may not work, as I couldn't test everything with some files being on your server. But inside modal.js, find the lines:


if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
this.interVeil.style.display="none"

And change that to:


if (this.veilstack==0){ //if this is the only modal window visible on the screen, and being closed
this.interVeil.style.display="none"
this.interVeil.style.left="-1500px"
this.interVeil.style.top="-1500px"
}

It seems on your page, for some reason, just hiding the veil isn't enough. The new code also moves it out of the screen.

Emile
06-21-2007, 10:39 AM
I tried above solution but it didn't fix my problem.

The problem lies in that the onmousemove event is set to null (for some reason on the underlying window, as it doesn't occure on the DHTML Window itself).
Is there any way that you can store the previous onmousemove event and restore that when you close the DHTML Window?

The workarround for the drag problem is that I reset the onmousemove event in the onclose function of the DHTL Window.



function openInboedelBereken() {
inboedelBerekenWin=dhtmlmodal.open('InboedelWindow', 'iframe', 'generali_bereken_inboedel.asp', 'Bereken de inboedelwaarde', "width=720px,height=480px,center=1,resize=0,scrolling=0", "recal")
inboedelBerekenWin.onclose=function() {

... my code here ...

document.onmousemove=positiontip

return true;
}
}



But the close event if you click right top icon isn't triggering this function so the workarround is not working for that.

Emile
06-21-2007, 11:02 AM
I made a fix for myself, I changed the following to the modal.js:

I made a global variable:


var onMouseMoveEvent


I stored the onmousemove event in this variabale in the open function


open:function(t, contenttype, contentsource, title, attr, recalonload){
onMouseMoveEvent = document.onmousemove // store previous onmousemove event
var d=dhtmlwindow //reference dhtmlwindow object
... rest if the function code


And I restore the onmousemove event at the close and forceclose functions


close:function(t){ //user initiated function used to close modal window
t.contentDoc=(t.contentarea.datatype=="iframe")? window.frames["_iframe-"+t.id].document : t.contentarea //return reference to modal window DIV (or document object in the case of iframe
var closewinbol=dhtmlwindow.close(t)
if (closewinbol){ //if var returns true
this.veilstack--
if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
this.interVeil.style.display="none"
document.onmousemove=onMouseMoveEvent // restore previous onmousemove event
}
},

forceclose:function(t){ //function attached to default "close" icon of window to bypass "onclose" event, and just close window
dhtmlwindow.rememberattrs(t) //remember window's dimensions/position on the page before closing
t.style.display="none"
this.veilstack--
if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
this.interVeil.style.display="none"
document.onmousemove=onMouseMoveEvent // restore previous onmousemove event
},


This works fine and solves all my problems.

(cleared all my typos *sighs*)

ddadmin
06-21-2007, 06:47 PM
Glad to see you were able to solve the problem yourself nevertheless. :)