2 Replies Latest reply on Mar 2, 2010 6:41 AM by Loic.Aigon

    InDn CS4 & JS: Drag and Drop events possible?

    bvotteler

      Hello,

       

      I have a generic question regarding drag'n'drop event capturing with jsx in InDesign.

       

      I do have a Advanced UI Dialog with several elements (loaded from a remote server, including images, texts, etc) listed in it.

      Now I would like to have the possibility to drag and drop these elements into frames on a document.

       

      Is this even possible with jsx, or would I need to write a plug-in for doing anything like that?

       

       

      So far, I could only find a vey limited set of eventListeners in the documentation. And I'm not sure if I could even capture such an event as "some object has been dropped in target x in document y".

       

      It would be great if anyone could point me in the right direction regarding this matter.

       

      Cheers,

       

      bvotteler

        • 1. Re: InDn CS4 & JS: Drag and Drop events possible?
          Harbs. Level 6

          Script UI does not support drag and drop.

           

          For drag and drop within a dialog (or panel), you can use Flex and 

          PatchPanel, but even that will not allow you to drop in a document.

           

          For full drag/drop, you need C++ as a plugin.

           

          Harbs

          • 2. Re: InDn CS4 & JS: Drag and Drop events possible?
            Loic.Aigon Adobe Community Professional

            Why not about a process based on identification ?

             

            placeItems.gif

             

            #targetengine session
            
            
            Application.prototype.main = function(){
                 if(this.documents.length>0){
                      var doc = app.activeDocument;
                      var rapidDlg = new Window('palette',"<Replace Me>",undefined);
                      buildWindow();
                      rapidDlg.show();
                 }
                 
                 function buildWindow(){
                 // Properties for rapidDlg.Group1
                      rapidDlg.Group1 = rapidDlg.add('group',undefined);
            
                 // Properties for rapidDlg.Group1.StaticText2
                      rapidDlg.Group1.StaticText2 = rapidDlg.Group1.add('statictext',undefined,"pages");
            
                 // Properties for rapidDlg.Group1.DropDownList1
                      var pg = doc.pages.everyItem().name;
                      rapidDlg.Group1.DropDownList1 = rapidDlg.Group1.add('dropdownlist',undefined,undefined,{items:pg});
                      rapidDlg.Group1.DropDownList1.selection = app.layoutWindows[0].activePage.name-1;
                      rapidDlg.Group1.DropDownList1.preferredSize.width = 60;
            
                 // Properties for rapidDlg.Group2
                      rapidDlg.Group2 = rapidDlg.add('group',undefined);
            
                 // Properties for rapidDlg.Group2.ListBox1
                      var pi = app.layoutWindows[0].activePage.pageItems.everyItem().getElements();
                      
                      rapidDlg.Group2.ListBox1 = rapidDlg.Group2.add('listbox',undefined,undefined);
                      for(var i =0; i<pi.length; i++){
                           rapidDlg.Group2.ListBox1.add('item',pi[i].constructor.name);
                      }
                      
            
                 // Properties for rapidDlg.Button1
                      rapidDlg.Button1 = rapidDlg.add('button',undefined,"place");
                 }
            }
            
            app.main();
            

             

            This code is very rough but it could be a start.

            Loic