1

Using TideSDK, how would I go about using a div or any element to drag/move the application window around the desktop? I'm looking to mimic the default behavior of the operating system frame (click and drag to move the application around)

I have my tiapp.xml set to false to remove the window border and I have created the close button with the Ti.App.exit method, but I cannot find a way to allow the user to move the application around. I don't believe I would use the jquery draggable library because that would move the element, not the entire window.

blockloop
  • 5,565
  • 5
  • 30
  • 31
  • I just offered an answer to similar question (asked after yours, sorry, I just came across it first). Might interest: http://stackoverflow.com/a/18883168/135114 – Daryn Sep 18 '13 at 22:25
  • I've actually long since switched to [node-webkit](https://github.com/rogerwang/node-webkit) but thanks for answering. I don't have tide installed anymore so I can't even test it out. – blockloop Sep 19 '13 at 18:53

1 Answers1

0
        var WINDOW = Ti.UI.getCurrentWindow();

        var dragging = false;
        document.onmousemove = function(){
            if (!dragging) return;
            Ti.UI.currentWindow.setX(Ti.UI.currentWindow.getX() + event.clientX - xstart);
            Ti.UI.currentWindow.setY(Ti.UI.currentWindow.getY() + event.clientY - ystart);
        }

        document.onmousedown = function(){
            dragging = true;
            xstart = event.clientX;
            ystart = event.clientY;
        }

        document.onmouseup = function(){
            dragging = false;
        }

Here is a piece of code I copied from tideSDK's site that works.

Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247