This is a migrated thread and some comments may be shown as answers.

Toying around with docks, trying to fake a "dock palette"

1 Answer 23 Views
Dock
This is a migrated thread and some comments may be shown as answers.
SungamRammah
Top achievements
Rank 1
SungamRammah asked on 21 Jun 2009, 05:16 AM
Hi, I am evaluating the demo and I am trying to realize one of my client's ideas. Dynamically creating docs by dragging images from a palette down to the dock zone.

I am using your dynamic dock example and a hidden Dock when you drop the hidden dock I do not dock that one but instead create the appropriate dock in server code.

I use the code below to move the hidden dock to the handle object. Unfortunately this breaks as soon as I start dragging, obviously because the position is not updated from the current setting of clientHeight and Width but rather from the original position of the dock at the time of the mouseDown. Is there a smart way to get past this. I actually think my clients idea is quite smart, to have a number of code blocks that is used as templates that you can drag new docks from. I am very impressed with the Telerik suite, to solve this would just be the icing of the cake for my presentation :)

/Magnus

            var obj = document.getElementById("Handle_" + dock.get_id()); 
            var output = new Object(); 
            var mytop = 0, myleft = 0; 
            output.width = obj.clientWidth; 
            output.height = obj.clientHeight; 
 
            while (obj) { 
                mytop += obj.offsetTop; 
                myleft += obj.offsetLeft; 
                obj = obj.offsetParent; 
            } 
            output.left = myleft; 
            output.top = mytop; 
            dock.set_top(output.top); 
            dock.set_left(output.left); 
            dock.set_width(output.width); 
            dock.set_height(output.height); 

1 Answer, 1 is accepted

Sort by
0
SungamRammah
Top achievements
Rank 1
answered on 21 Jun 2009, 07:10 AM
True to my habit of asking questions to quick i will try to compensate with answering myself.

I simply forgot to undock the hidden dock. Now it works like a charm and I can spawn docks by dragging my "template divs" to the docking zones.
Tags
Dock
Asked by
SungamRammah
Top achievements
Rank 1
Answers by
SungamRammah
Top achievements
Rank 1
Share this question
or