Hi all,

I know it's been a couple of weeks since I posted this.

I've now managed to achieve what I was wanting to do. I can now drag
one or more files into my qooxdoo app from an external file manager,
and have them processed

(See below)

On 6 October 2012 16:06, Nick Glencross <[email protected]> wrote:
>
> Hi all,
>
> I know the qooxdoo web site says that HTML5 Drag and Drop isn't very well 
> designed, and there are currently no plans to support it.
>
> However, being able to drag files into and out of a Qooxdoo app is obviously 
> nice functionality. Has anyone had a play with this and managed to get this 
> functionality to work out of interest?


In the constructor of a container:

      this.addListener('appear',
                       function()
                       {
                          var element =
this.getContentElement().getDomElement();
                          element.ondrop     = XXX.html5drop;
                          element.ondragover = function() {return false; }
                          element.ondragover = function() {return false; }
                       },
                      this);

Then as static methods in class XXX:

      html5drop : function(e)
      {
          XXX.html5dropfiles(e.dataTransfer.files);

          e.stopPropagation();
          e.preventDefault();
      },

      html5dropfiles : function(files) {

          for (var i = 0, f; f = files[i]; i++) {

              var filereader = new FileReader();

              filereader.onload = (function(aFile) {

                  return function(e) {
                
                      var xhr = new XMLHttpRequest();

                       /// ...
                  };
              })(f);

              filereader.readAsBinaryString(f);
          }
      }


Hope that might help someone in future,

Cheers,

Nick

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to