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

2 posts, 0 answers
  1. SungamRammah
    SungamRammah avatar
    10 posts
    Member since:
    Jul 2007

    Posted 21 Jun 2009 Link to this post

    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); 

  2. SungamRammah
    SungamRammah avatar
    10 posts
    Member since:
    Jul 2007

    Posted 21 Jun 2009 Link to this post

    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.
Back to Top