Sign in to follow this  
Followers 0
Underdogger

Drag & Drop with Fileopendialog

4 posts in this topic

#1 ·  Posted (edited)

[Replace Problem]

Hello, guys!

I got a new problem...

When I drop file to the edit box at the 1st time, it would appear correct path..

Dropping file to the edit box at the 2nd time, it would replace the path which was the 1st one correctly..

Problem : While I click the load button>>[...] to get path, then drop the new file to the edit box again, but IT would not replace the previous one path...

#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$BForm = GUICreate("Drop & Drag", 499, 95, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetOnEvent($GUI_EVENT_DROPPED, "_Drop")
$Fpath = GUICtrlCreateInput("", 10, 28, 447, 25)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$LogPath = GUICtrlCreateButton("TEST", 460, 25, 35, 30, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $LogPath
GUICtrlSetData($Fpath, FileOpenDialog("Choose File", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All file(*.*)", 1))
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func _Drop()
GUICtrlSetData($Fpath, @GUI_DragFile)
EndFunc ;==>_Drop

Best Regard

Edited by Underdogger

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

_Drop function is not called,

the Input handles it internally

There is even a logical error,

with a Message loop Events are never called

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This way it will help you

#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$BForm = GUICreate("Drop & Drag", 499, 95, -1, -1, -1, $WS_EX_ACCEPTFILES)
$Fpath = GUICtrlCreateInput("", 10, 28, 447, 25, 0)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$LogPath = GUICtrlCreateButton("TEST", 460, 25, 35, 30, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $LogPath
GUICtrlSetData($Fpath, FileOpenDialog("Choose File", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All file(*.*)", 1))
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
_Drop()
EndSwitch
WEnd

Func _Drop()
GUICtrlSetData($Fpath, @GUI_DragFile)
EndFunc ;==>_Drop

Setting the style to 0, will make your function get invoked

Regards :)

Edited by PhoenixXL
1 person likes this

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

This way it will help you

#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$BForm = GUICreate("Drop & Drag", 499, 95, -1, -1, -1, $WS_EX_ACCEPTFILES)
$Fpath = GUICtrlCreateInput("", 10, 28, 447, 25, 0)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$LogPath = GUICtrlCreateButton("TEST", 460, 25, 35, 30, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $LogPath
GUICtrlSetData($Fpath, FileOpenDialog("Choose File", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All file(*.*)", 1))
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
_Drop()
EndSwitch
WEnd

Func _Drop()
GUICtrlSetData($Fpath, @GUI_DragFile)
EndFunc ;==>_Drop

Setting the style to 0, will make your function get invoked

Regards :)

PhoenixXL

You always solved my problem very fast!!

Thanks so much!!

Best Regard

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