Sign in to follow this  
Followers 0
N W

Drag multiple files into edit control

9 posts in this topic

I'm trying to set up an edit control that allows me to drag multiple files into it. (Then I will process those files in a later step.)

I can type in multiple lines to this control, but every time I drag a file in, it replaces the contents, rather than appending.

Additionally (relatedly?), when I drag multiple files into it at once, only one appears.

I've browsed around the forums a lot and haven't seen anything that answers this.

#include <GUIConstants.au3>

GUICreate("Aaaaargh!", 830, 800, -1  , -1 , -1, 0x00000018); WS_EX_ACCEPTFILES

$CANCELbtn = GUICtrlCreateButton     ("Cancel"   , 750,  5, 60, 20)
$OKbtn = GUICtrlCreateButton     ("OK"   , 750,  35, 60, 20)

$mylist = GUICtrlCreateEdit ("Add Files here!",10,70,200,300, BitOr($GUI_SS_DEFAULT_EDIT, $ES_MULTILINE) )
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $CANCELbtn
            exitloop
        Case $msg = $OKbtn
            MsgBox(4096,"result",GUICtrlRead($mylist))
    EndSelect
Wend

exit

Thanks a lot!

--NW

Share this post


Link to post
Share on other sites



Try

GUICtrlCreateList

I dont know how to put stuff in there.

But it may -hlep- you

Share this post


Link to post
Share on other sites

Creating a list instead of an edit would be fine, but I can't get the file into there, either.

Share this post


Link to post
Share on other sites

maybe this

#include <GUIConstants.au3>

GUICreate("Aaaaargh!", 630, 600, -1  , -1 , -1, $WS_EX_ACCEPTFILES ); 0x00000018); WS_EX_ACCEPTFILES

$CANCELbtn = GUICtrlCreateButton     ("Cancel"   , 750,  5, 60, 20)
$OKbtn = GUICtrlCreateButton     ("OK"   , 750,  35, 60, 20)

$mylist = GUICtrlCreateEdit ("Files will be Added here!",10,70,200,300);, BitOr($GUI_SS_DEFAULT_EDIT, $ES_MULTILINE) )
$myinput = GUICtrlCreateInput("Drop File here", 10, 372, 160, 20)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$mybtn = GUICtrlCreateButton("&Insert", 170, 372, 40, 20)
GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    
    Select
    Case $msg = $mybtn
            GUICtrlSetData($mylist, (GUICtrlRead($myinput)) & @CRLF, 1)
        Case $msg = $CANCELbtn
            exitloop
        Case $msg = $OKbtn
            MsgBox(4096,"result",GUICtrlRead($mylist))
    EndSelect
Wend

exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Hmmm. A step in the right direction, I suppose--thanks!

But I want to be able to drag multiple files at once (i.e., select several at once in Windows Explorer, and drag them as a group). Still can't figure that out.

--N W

Share this post


Link to post
Share on other sites

why cant u just make it so if u drag to the big edit then it inserts them ?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

why cant u just make it so if u drag to the big edit then it inserts them ?

#include <GUIConstants.au3>
GUICreate("Aaaaargh!", 630, 600, -1  , -1 , -1, $WS_EX_ACCEPTFILES ); 0x00000018); WS_EX_ACCEPTFILES
$CANCELbtn = GUICtrlCreateButton     ("Cancel"   , 750,  5, 60, 20)
$OKbtn = GUICtrlCreateButton     ("OK"   , 750,  35, 60, 20)
$mylist = GUICtrlCreateEdit ("Files will be Added here!",10,70,200,300);, BitOr($GUI_SS_DEFAULT_EDIT, $ES_MULTILINE) )
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUISetState ()
$msg = 0

While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()

    Select
        Case $msg = $CANCELbtn
            exitloop
;       Case $msg = $OKbtn
;           MsgBox(4096,"result",GUICtrlRead($mylist))
    EndSelect
Wend

exit

Modifed Valuators Code / Requires Latest Beta TO work

Hardcopy

Edit : Couldnt Spell my Name

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

hardcopy ur thing only let it add 1 file

i would edit it but i have to go :lmao:

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

hardcopy ur thing only let it add 1 file

i would edit it but i have to go ;)

Pardon? Works fine for me

Select multiple files in explorer, Drag to EditControl, Drop all files show.

Perhaps it because u in a rush to go!!

:lmao:

HardCopy

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

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