Hi Everyone,

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 wrote alternative code where the mousedown function toggled the  
status of "capture" so that I could click on the widget, move it  
around, and click again to release it.  This will do for now, but I  
would really like the concept of "dragging" while the mouse is pushed  
down.  Can anyone see whats wrong?

To see it in action, visit www.laststopstudios.com/icoti/icoti.html

here is my current code.



window.application.main = function()
                {
                
                  var d = this.getClientWindow().getClientDocument();

                  var w1 = new QxAtom("drag me");;
                  w1.setBackgroundColor("#222200");
                  w1.setTop(0);
                  w1.setLeft(0);
                  w1.setWidth(100);
                  w1.setHeight(100);
                
                  w1.addEventListener("dragstart", handleDragStart);
                  w1.addEventListener("dragend", handleDragEnd);
                  w1.addEventListener("mousedown", handleMouseDown);
                 w1.addEventListener("mousemove", handleMouseMove);
                 w1.addEventListener("mouseup", handleMouseUp);
                
                        function handleDragStart(e)
                        {
                          e.addData("text/plain", "Plain text");
                          e.addAction("copy");
                          e.addAction("move");
                          e.addAction("alias");
                        
                          e.startDrag();
                        };
                        
                        function handleDragEnd(e){
                                
                        };
                        
                        
                        function handleMouseDown(e)
                        {
                                        this.setCapture(true);
                        };
                
                        function handleMouseMove(e)
                        {
                                 if (this.getCapture())
                                 {
                                         this.setLeft(e.getPageX() - 50);
                                         this.setTop(e.getPageY() - 50);
                                 }
                        };
                                        
                        function handleMouseUp(e)
                        {
                           this.setCapture(false);
                        };
                        
                        
                        d.add(w1);
                
                }

- Jon

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