473,473 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

creating new elements & adding drag & drop functionalities (with wz_dragdrop.js library)

var c = document.getElementById("PanelTree");
// PanelTree is a <div> element!

var n = document.createElement("div");
n.setAttribute('id', 'nu');
n.setAttribute('style', 'position:absolute;left:0px;top:0px;');

var tmp2 = document.createTextNode('hello');

n.appendChild(tmp2);
c.appendChild(n);

//Here evrething works, I see the element attached on PanelTree
// but when I add this..

ADD_DHTML("nu");
dd.elements.nu.write("new hello");
// "new hello" is written
dd.elements.controlPan.addChild(dd.elements.nu);
// it is visible but it doesn't have drag & drop funtionalites!!
//Why??
Maybe wz_dragdrop.js library does not support elements created
dinamically??

My head hurts.. my heart too..

Please help!!

Miko

Dec 2 '05 #1
2 3457
VK

mi*****@gmail.com wrote:
dd.elements.nu.write("new hello");


What is that? Is your custom write() method?

Otherwise there is only document.write() method and it clears the page
and kills the script if used after the page loaded. The only exception
is to write to another iframe / frame.

Dec 2 '05 #2
mi*****@gmail.com wrote:
var c = document.getElementById("PanelTree");
// PanelTree is a <div> element!

var n = document.createElement("div");
n.setAttribute('id', 'nu');
n.setAttribute('style', 'position:absolute;left:0px;top:0px;');
Do not use setAttribute(), its implementations are buggy.

n.id = 'nu';
if (typeof n.style != "undefined)
{
n.style.position = 'absolute';
n.style.left = '0';
n.style.top = '0';
}
var tmp2 = document.createTextNode('hello');

n.appendChild(tmp2);
c.appendChild(n);

//Here evrething works, I see the element attached on PanelTree
// but when I add this..

ADD_DHTML("nu");
dd.elements.nu.write("new hello");
Am I assuming correctly that ADD_DHTML("nu") adds a reference to the element
with ID `nu' to the dd.elements collection? However HTMLDivElement objects
do not have a write() method. Maybe you are assuming that positioned `div'
elements become NN4-only Layer objects which have a _document.write()_
method. (Well, maybe not :))
// "new hello" is written
dd.elements.controlPan.addChild(dd.elements.nu);
// it is visible but it doesn't have drag & drop funtionalites!!
//Why??
Maybe wz_dragdrop.js library does not support elements created
dinamically??
Maybe. If you pointed to the library you are using and error messages, it
would have been possible to find that out.

OK, today's my social day: the first Google hit points to
<URL:http://www.walterzorn.de/dragdrop/dragdrop.htm>.
Let's see, there is <URL:http://www.walterzorn.de/scripts/wz_dragdrop.js>:

| function ADD_DHTML(d_o) // layers only!
| {
| d_o = new DDObj(d_o);
| dd.addElt(d_o);
| dd.addProps(d_o);
| dd.mkWzDom();
| }

OK, ADD_DHTML() creates a new DDObj ...

| dd.addElt = function(d_o, d_p)
| {
| dd.elements[d_o.name] =
| dd.elements[d_o.index = dd.elements.length] = d_o;
| if(d_p) d_p.copies[d_o.name] = d_p.copies[d_p.copies.length] = d_o;
| };

| function DDObj(d_o, d_i)
| {
| this.id = d_o;
| [...]
| this.name = this.id + (d_i || '');
| [...]
| }

.... dd.addElt() adds the object to the `elements' collection. So your

dd.elements.nu.write

refers to

| DDObj.prototype.write = function(d_x, d_o)
| {
| this.text = d_x;
| if(!this.div) return;
| if(dd.n4)
| {
| (d_o = this.div.document).open();
| d_o.write(d_x);
| d_o.close();
| dd.getWH(this);
| }
| else
| {
| this.css.height = 'auto';
| this.div.innerHTML = d_x;
| if(!dd.ie4) dd.recalc();
| // n6.0: recalc twice
| if(dd.ie4 || dd.n6) setTimeout('dd.recalc();', 0);
| }
| };

Now you have to find out which branch in DDObj.prototype.write() is taken.
`dd' refers to a WZDD object:

| function WZDD()
| {
| [...]
| this.n4 = !!(document.layers && typeof document.classes != dd_u);
| [...]
| }
| var dd = new WZDD();

The next step would be to find out what each operand evaluates to in a
boolean expression and then check each statement in the respective branch.
Happy debugging!
My head hurts.. my heart too..


You should see a doctor immediately ;-)
PointedEars
Dec 2 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ed Sutton | last post by:
I am looking for a WinForms drag and drop example that shows how to implement dragging from a WinForm treeView and dropping on another application. I have drag & drop working from within the...
0
by: Andy | last post by:
Hi all, I'm developing an application which allows a drag and drop of files onto a ListView control. Everything works fine on my Windows XP development computer, but when i move the...
3
by: Kyle Fitzgerald | last post by:
I've started a web control library project and can build my own controls to add to the toolbox in the .NET environment. The problem I'm having is I want to create a control just like the HTML...
6
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: ...
1
by: Taptu¶ | last post by:
Hi, Is there any way to use D&D functionality with panel ? Ex. I have 2 panels: panel 1 and panel2 I want to drag panel1 over panel2 and change parent value of panel1 after Drop panel1.parent...
5
by: murrayatuptowngallery | last post by:
I saw a 2-D (like a joystick) slider widget awhile ago. I thought it was on the dojotoolkit.org Demo page, but no one there acknowledges it (they don't deny it either). I would like to learn how...
1
by: kidelectric | last post by:
The issue I am having is that I would like to be able to drag-and-drop div elements that have rounded corners.* Since these elements will be dynamically created (including background color), I could...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.