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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted
1 hour ago, Melba23 said:

FrankSchneidewind,

How about this?

M23

 

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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)
27 minutes ago, Melba23 said:

FrankSchneidewind,

Looks as if you forgot a vital style:

$Form1 = GUICreate(... $WS_EX_ACCEPTFILES)

M23

Still doesn't work and now the exit and minimize buttons are gone :/ 

Edited by FrankSchneidewind
  • 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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • 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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...