Jump to content

Recommended Posts

Posted

Hi all,

I got a quick question regarding Drag&Drop with GUIs. I made a little script that does something with files and I need a way to get the name/path of the file when I drag&drop it into the GUI. Is there a quick way to do this?

Tyvm in advance!

Neo

  • Moderators
Posted

FrankSchneidewind,

How about this?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
  On 8/25/2016 at 3:14 PM, Melba23 said:

FrankSchneidewind,

How about this?

M23

Expand  

 

Thanks this helped alot.

My form looks like this now:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
;#include <GUIConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>
#include <File.au3>
#include <INet.au3>
#include <String.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("DVD Videosoft Updater", 306, 110, 390, 222)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$status = GUICtrlCreateLabel("Nothing to do right now", 136, 8, 152, 17)
GUICtrlSetState($status, $GUI_DROPACCEPTED)
$useOwnINI = GUICtrlCreateCheckbox("Use own links.ini", 8, 8, 97, 17)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$download_start = GUICtrlCreateButton("Download", 8, 32, 107, 25)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$progressbar = GUICtrlCreateProgress(136, 32, 150, 25)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$Label2 = GUICtrlCreateLabel("Drag && Drop!", 80, 80, 145, 17, $SS_CENTER)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_DROPPED
            Global $droppedfile = @GUI_DragFile
            MsgBox(0,"",$droppedfile)
    EndSwitch
 WEnd

I still can't drop files in there - the "no dop" mouse-icon appears every time i try to drop a file...

Any idea what could be the reason for this?

Thanks!

  • Moderators
Posted

FrankSchneidewind,

Looks as if you forgot a vital style:

$Form1 = GUICreate(... $WS_EX_ACCEPTFILES)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

FrankSchneidewind,

I bet you put it in the "normal style" rather than the "extended style" position - this is how it should look:

$Form1 = GUICreate("DVD Videosoft Updater", 306, 110, 390, 222, Default, $WS_EX_ACCEPTFILES)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

FrankSchneidewind,

Glad to hear it.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
×
×
  • Create New...