Jonathan Delgado <[EMAIL PROTECTED]> writes:

> I just want to have a script that takes a widget and enables the  
> ability to drag it around the screen.  This should be relatively  
> simple, but my code is having some problems.  For this simple  
> example, im just using a QxAtom.  When I click it, i am allowed to  
> drag it for a very short space (10 pixels or so) and then it freezes  
> until I click on it again.

I think your problem is that the events are on w1, and as soon as you get out
of the bounds of w1, you stop receiving those events, so it stops moving.

Here's a working sample that drags the atom called a1 around the screen.  This
is written in the namespaces branch style, but you should get the idea.

  qx.core.Init.defineMain(function()
  {
    var d = this.getClientWindow().getClientDocument();
    
    var a1 = new qx.ui.basic.Atom("Drag Me");
    a1.set({ backgroundColor: "white", border: 
qx.renderer.border.BorderObject.presets.groove });
    a1.setPadding(10);
    a1.setLocation(20, 48); 
    d.add(a1);

                
    d.addEventListener("mousedown", handleMouseDown);
    d.addEventListener("mousemove", handleMouseMove);
    d.addEventListener("mouseup", handleMouseUp);
                
    function handleMouseDown(e)
    {
      this.setCapture(true);
    }
                
    function handleMouseMove(e)
    {
      if (this.getCapture())
      {
        a1.setLeft(e.getPageX());
        a1.setTop(e.getPageY());
      }
    }
                                        
    function handleMouseUp(e)
    {
      this.setCapture(false);
    };
  });

Cheers,

Derrell

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to