Home | Free Lite Version | Buy Now | Free Bonuses | Free Stuff | Links



Popup Drag & Drop Dialog

The xDialog Popup Drag & Drop dialog adds file drag & drop to your AMS applications. Used in conjunction with an AMS ListBox or ComboBox object, it lets you drag & drop files and have them added to the listbox or combobox. It's perfect when you need to select files from multiple folders, create music play lists or image slide shows etc.

You can set the title, the width and the height. See the code example below.

Download Demo Application to see it in action.

 

This example assume that the xDialog functions have been added to the Global functions. You can easily do this using the Add Code button on the Script Editor.

Example


-- Thus function is used to sperate the values from the return string
function DelimitedStringToTable(DelimitedString, Delimiter)

   
tbReturn = {}
   
local strWorking
   
local nPos = nil
   
local strData
   
local nTableIndex = 1
   
local nDelimiterLength = String.Length(Delimiter)
   
   if(nDelimiterLength < 1)then
      tbReturn[nTableIndex] = DelimitedString
      return tbReturn
   
end
   
   strWorking = DelimitedString
   nPos = String.Find(strWorking, Delimiter)

   while(nPos ~= -1)do
      strData = String.Left(strWorking, nPos -1)
      tbReturn[nTableIndex] = strData
      nTableIndex = nTableIndex + 1
      local nLength = String.Length(strWorking)
      strWorking = String.Right(strWorking, nLength - (nPos + (nDelimiterLength -1)))
      nPos = String.Find(strWorkingDelimiter)
   end

   if(strWorking ~= "")then
      tbReturn[nTableIndex] = strWorking
   
end
   
   
return tbReturn
end

------------------------------------------------------------------------------------------------

Files = xDialog.Show_DragnDrop("Drag & drop files on the list below", 500, 400)

-- If the Cancel button was not clicked, then get list of files returnd
if Files ~= "CANCEL" then

      -- Use the DelimitedStringToTable function to seperate the files returned. The files will be delimited by "|"
   tFiles = DelimitedStringToTable(Files, "|")
   
   if tFiles and Table.Count(tFiles) > 0 then
      for = 1, Table.Count(tFiles) do
         ListBox.AddItem("FileList", tFiles[n], tFiles[n])
      end
   end
   
end

 

Copyright © 2007 All Rights Reserved