Click to See Complete Forum and Search --> : Drag Image in Netscape 6


darianw
12-23-2002, 05:32 PM
Hello all,

I'm trying to dynamically create a selection region by drawing a layer to match the mouse start, move, and end location.

What I have been doing is showing a layer (top,left = mouse x,y, and width,height start at 1) with a red background when the mouse down is clicked, and then, when the mouse is dragged, I update the width and height of the layer based on where the movse has been moved to - basically drawing a box as the users moves the mouse. When the mouse is released I stop the dragging and the "box" is finished.

This works great on the IE, but when I use netscape the box doesn't start drawing until I let go of the mouse. So you can't see the box being drawn. It seems as if the mouse down even won't let the mouse move even work until the mouse has been let up, which is too late by then...

Any ideas on what I'm missing? Any help is appreciated!

Thanks,
Darian.

khalidali63
12-24-2002, 09:08 AM
I guess if you post your code here some one will take a shot at it to make it work..

Khalid

freebie
01-09-2003, 01:14 PM
Hey Darian,
I'm trying to do the same thing, but I haven't gotten the code down for IE yet. Would you be interested in sharing that with the rest of us, or are you developing something proprietary?

darianw
01-09-2003, 02:19 PM
Originally posted by freebie
Hey Darian,
I'm trying to do the same thing, but I haven't gotten the code down for IE yet. Would you be interested in sharing that with the rest of us, or are you developing something proprietary?

The IE version of this is pretty simply. It's basically the same code that's used in a drag-and-drop scenario. You can find a number of examples at dynamicdrive.com or a similiar site.

What I am doing with it is quite a bit more complicated though, I have a number of 'collision areas' and 'bounding rectangles' that the drag region has to take into consideration. Plus this is overlayed on top of a dynamic image, which happens to be nested inside a number of other layers (and even a few tables).

But, the bottom line is that the difference I found with Netscape is that the mousedown event needed to be set in the init area, and left "on" throughout. (I was turning it off once the mouse was up, or until they were back into my special region where they could drag the box. - this works fine in IE). So now I just set/clear a boolean when the mouse is over/out of the specified region to retain this control.

If you need more specific examples, I'd be happy to send you some simple sample code.

HTH,
Darian.

freebie
01-09-2003, 03:53 PM
Hey Darian,
thanks for replying.
If you have access to some simple examples, I would really appreciate it. What I'm trying to do is on the current message board thread titled "dhtml selection tool". Any examples would be helpful.
Here's my email.
Jeffro3377@yahoo.com

thanks again,
Jeff

darianw
01-09-2003, 04:12 PM
Jeff,

Hopefully these will help you some. There's an example for IE and Netscape. Let me know if you need anything else.

http://www.dkrz.de/~k202039/dhtml/dragdrop/dragdroppt1.html - supposed to work in both browsers
http://www.walterzorn.com/dragdrop/dragdrop_e.htm (downside - requires his javascript)

HTH,
Darian.

freebie
01-09-2003, 04:29 PM
thanks darian.
that helps.
pretty cool stuff