Jump to content

drag & drop question


rakudave
 Share

Recommended Posts

i've got a "guictrlcreatelist"-list, accepting drag & drop, but just one file at a time...

is it possible to drop several files at once???

and if yes, how?

thx

i posted an example in scripts and scraps sometime ago.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

  • 2 weeks later...

dragdrop.au3 - sometime in february i think

http://www.autoitscript.com/forum/index.ph...822entry62822

On introduction to the code it says:

"The following script is designed to show off the drag/drop functionality of Autoit 3.1 ... *Should* work under 3.1.0, though only one file at a time will be able to be dropped."

And it really permits only dropping of one file at a time.

What I am looking for is precisely a way to make a GUICtrlCreateInput or GUICtrlCreateEdit to receive several marked files at a time.

Does someone have an idea?

Link to comment
Share on other sites

On introduction to the code it says:

"The following script is designed to show off the drag/drop functionality of Autoit 3.1 ... *Should* work under 3.1.0, though only one file at a time will be able to be dropped."

And it really permits only dropping of one file at a time.

What I am looking for is precisely a way to make a GUICtrlCreateInput or GUICtrlCreateEdit to receive several marked files at a time.

Does someone have an idea?

A good starpoint would be to look in the helpfile. Use the example and Drag&Drop some files on the input box.

HTH, Reinhard

Link to comment
Share on other sites

On introduction to the code it says:

"The following script is designed to show off the drag/drop functionality of Autoit 3.1 ... *Should* work under 3.1.0, though only one file at a time will be able to be dropped."

And it really permits only dropping of one file at a time.

What I am looking for is precisely a way to make a GUICtrlCreateInput or GUICtrlCreateEdit to receive several marked files at a time.

Does someone have an idea?

Uhh. You deleted the most pertinent portion of that quote, which indicated that it did work and does work the last time i checked with the BETA. 3.1.0 had a bug in it that has since been fixed, hence the warning that you only read half of.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

Uhh. You deleted the most pertinent portion of that quote, which indicated that it did work and does work the last time i checked with the BETA. 3.1.0 had a bug in it that has since been fixed, hence the warning that you only read half of.

Sorry for deleting part of your explanation. Here it comes entirely:

The following script is designed to show off the drag/drop functionality of Autoit 3.1 It was tested and compiled with a post 3.1.0 release, which incorporated multiple file drag/drop support. *Should* work under 3.1.0, though only one file at a time will be able to be dropped.

I tried the script with Autoit 3.1.1 and it did not work as expected. You can drop several files, but only one will be recognized.

Link to comment
Share on other sites

Each drop operation triggers ONE message perhaps this is your confusion. Look carefully at the msgbox output.

I just copied my old dragdrop.au3, and retested. The msgbox looks exactly as it ought to - a delimited list of files when a multiple selection is dropped on the control. The pre-beta version I wrote to used a @CRLF-delimited list, it appears that some time in the future the delimiter on a multi-file drag/drop was changed to a pipe (perhaps this is a control-specific setting in au3?) .Adjust accordingly.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

try this modified (works with beta only far as I can tell):

;===============================================================================

; Script Name:          DragDrop.Au3
; Description:          Demonstrate Handling a FileDrop Operation in Autoit 3.x
; Parameter(s):        None
; Requirement(s):        Not tested under 3.1.0 or earlier
; Return Value(s):      None
; Author(s):              FlyingBoz
; Date:                20 Feb 2005
;===============================================================================



#include <GuiConstants.au3>

; GUI
;Note GUI Created with the Extended Windows Style ACCEPTFILES
GUICreate("Drag/Drop Demo", 220, 220, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetIcon(@SystemDir & "\mspaint.exe", 0)

; INPUT
;string for default status of InputBox
Global $txtInput = "Input Box Accepts Files"
;Create handle for Input Box.
Global $hInput = GUICtrlCreateInput($txtInput, 10, 10, 200, 200, BitOR($ES_MULTILINE, $ES_LEFT, $ES_AUTOHSCROLL));Specify that the control can respond to ACCEPTFILES messages
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
GUISetState()
;Initialize Message Status
Local $msg = ""
; GUI MESSAGE LOOP
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
;UDF to Monitor Controls that Accept Drag / Drop
;This is necessary becuase the drop operation does NOT send a message to the control,
;It simply dumps the CRLF separated list of files in the control, appending them to what went before.
    _MonitorFiles()
    
WEnd
Exit $msg

;===============================================================================
;
; Function Name:      _MonitorFiles
; Description:      Demonstrate Looping to Monitor the change of a drag/drop file operation
; Parameter(s):    None
; Requirement(s):    Autoit3.1.0
; Return Value(s):  None
; Author(s):          FlyingBoz
; Date:            20 Feb 2005

Func _MonitorFiles()
;FlyingBoz - monitor contents of $hinput control,
;display and reset when triggered.
    Local $text = GUICtrlRead($hInput)
    If $text <> $txtInput Then;Something has changed
;strip the default text
        $text = StringReplace($text, $txtInput, "")
;display what's left.
        $text = StringReplace($text, "|", @CRLF)
        MsgBox(0, "Change In Input Box!", $text, 0)
;NOTE: Obviously, more sophisticated handling
;should occur here - You will see when Files are
;dropped, this @CRLF separated list
;can be parsed, tested with If FileExists(), etc.
        $txtInput = GUICtrlRead($hInput)
        GUICtrlSetData($hInput, $text)
    EndIf
EndFunc ;==>_MonitorFiles
;===============================================================================
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

@ gafrost

Thanks for your intension to help. The screenshot of my last posting was obtained with exactly the script code you mentioned, using AutoIt 3.1.1.0

Now I tested the script with beta AutoIt 3.1.1.107 and it works fine.

Edited by wolfbartels
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...