Hi
i want dragdrop option item between two listbox.
when fire onmousedown to dragdrop,listbox's selectedIndex is old.
beacuse onchange event after onmousedown event.
i also try componentFromPoint to get option,but didn't locate option.
does any one know how to get new Index in mousedown event or good idea to do
this ?
----------
by ziv
stuart@nexusnet.co.nz - 21 Oct 2004 02:35 GMT
I too am trying to do the same thing. I can drag the whole Select box but not the options[selectedIndex].value as it is still holding the previous value. I just wondered if you had found a solution to this problem?
sshimla - 09 Dec 2004 13:56 GMT
Hi Ziv, Ma Hamatzav? and Hi Stuart...
Drag and drop in DHTML is all about deception...
You need to show AS IF you are dragging from the list box where in
fact you are capturing the mousedown event and hover (with a DIV to
show the selectedIndex value next to your mouse - this will look
better)
And onmousemove plant the value in the other list box.
To make it neater you can also try to calculate over which value of
the 2nd list box you are standing and adding it straight after it (to
make it seem more real).
Just remember, list boxes and dropdowns always zIndex over any
floating DIVs so the nice hovering DIV might not appear over them,
better position it to the bottom right corner of the mouse cursor so
at least it will appear just before the "drop" (onmouseup)
Be sure to use SetCapture and ReleaseCapture... read about them some
more in MSDN or something.
I have some code samples I've written of magnificant drags&drops
in DHTML (for example, an IE version of the Windows Solitaire game),
I don't want to send them yet as they are painfully complicated to
understand straight off...
Try this or let me know if something is not clear and lets take it
from there...
All the best!