Sign in to follow this  
Followers 0
reggy

File list drag and drop

1 post in this topic

#1 ·  Posted (edited)

I want to introduce my decision of file list drag&drop problem.

Macro @Gui_DragFile consists only the last item in the dropped list,

so I create background control to handle drop event:

#include <GUIConstants.au3>

GUICreate('Drop Area', 400, 300, -1, -1, -1, $WS_EX_ACCEPTFILES)

; The control to receive information
; Y=-100 to hide text and HEIGHT+100 to cover whole the window

$drop = GUICtrlCreateInput('', 0, -100, 400, 400, $WS_DISABLED + $ES_AUTOHSCROLL, 0)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

;------------------------
; Create other controls here
;------------------------

GUISetState()

$msg = 0

while $msg <> $GUI_EVENT_CLOSE
  $msg = GUIGetMsg()
    
  if not $msg then
  elseif $msg = $GUI_EVENT_DROPPED then
    if @GUI_DRAGID = -1 then    ; File(s) dropped
      $files = GUICtrlRead($drop)  ; File list in the form: file1|file2|...

      MsgBox(0, 'Dropped', StringReplace($files, '|', @CR))
    endif
  endif
wend
 
GUIDelete()

I hope it would be helpful.

Good luck!

Edited by reggy

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0