jantograaf Posted February 20, 2020 Posted February 20, 2020 Hi all, I've been looking around the forum and testing different ways of getting a 'drop zone' to work in my script, but I can't seem to get any response from the event listener. Code compiles perfectly. Chaning the control from a label to an input- or edit-field doesn't change its behaviour, still no response when a file is dropped on there... It might just be that I am overlooking a simple detail, so I'm hoping for an extra pair of eyes here or there who can spot why this isn't working as it should. I have another 3500+ lines script where I have basically the same bit of code, and it seems to work in there without problems. So, here it goes: expandcollapse popupGlobal $DD_GUI = GUICreate("DicomDrop",200,200,-1,-1,BitOR($WS_SYSMENU,$WS_POPUP),$WS_EX_ACCEPTFILES) GUISetBkColor(0x030303,$DD_GUI) $DD_GUI_DRAGLABEL = GUICtrlCreateLabel("",0,0,32,32,-1, $GUI_WS_EX_PARENTDRAG) $DD_GUI_DRAGIMAGE = GUICtrlCreateIcon(@ScriptFullPath,201,0,0,32,32) $DD_GUI_TITLELABEL = GUICtrlCreateLabel("DicomDrop",50,10,100,20,$SS_CENTER) GUICtrlSetFont($DD_GUI_TITLELABEL,8,$FW_SEMIBOLD,$GUI_FONTNORMAL,"Verdana") GUICtrlSetColor($DD_GUI_TITLELABEL,0xFFFFFF) $DD_GUI_CLOSE = GUICtrlCreateButton("X",174,4,24,24,$BS_FLAT) GUICtrlSetBkColor($DD_GUI_CLOSE,0x030303) GUICtrlSetColor($DD_GUI_CLOSE,0xFFFFFF) Global $DD_GUI_DROPZONE = GUICtrlCreateLabel("",10,42,180,148) GUICtrlSetState(-1,8) GUICtrlSetBkColor($DD_GUI_DROPZONE,0x181818) GUISetState(@SW_SHOW,$DD_GUI) Local $DD_MSG = 0 While 1 $DD_MSG = GUIGetMsg() Select Case $DD_MSG = $GUI_EVENT_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by GUI_EVENT_CLOSE") DD_EXIT() Case $DD_MSG = $GUI_EVENT_DROPPED If @GUI_DropId = $DD_GUI_DROPZONE Then Local $DroppedFile = @GUI_DragFile GUIDelete() ConsoleWrite(@CRLF & "Debug -- Dropped file : " & $DroppedFile) EndIf Case $DD_MSG = $DD_GUI_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by DD_GUI_CLOSEIMAGE") DD_EXIT() EndSelect WEnd Func DD_EXIT() GUIDelete($DD_GUI) Exit EndFunc If anyone has any idea whatsoever, please let me know 🙂 Thanks in advance and kind regards, Jan
Moderators Melba23 Posted February 20, 2020 Moderators Posted February 20, 2020 jantograaf, Your script as posted runs (when the required includes are added) without problem for me - I get the dropped filename written to the console for every drop. M23 jantograaf 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Nine Posted February 20, 2020 Posted February 20, 2020 Shouldn't you exit after GUIDelete ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
jantograaf Posted February 20, 2020 Author Posted February 20, 2020 Hi @Melba23, Thanks for the quick reply! 🙂 This was the scenario I was afraid of (since my code seemed correct). So, just to be 'complete', I have included all the includes I'm using right now. Overkill, I know, but I included all includes from the other script as the drop zone works in that one... expandcollapse popup#NoTrayIcon #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=DicomDrop.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Res_Icon_Add=drag.ico,201 #AutoIt3Wrapper_Res_Icon_Add=close.ico,202 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <MsgBoxConstants.au3> #include <GuiEdit.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <Array.au3> #include <FontConstants.au3> #include <AutoItConstants.au3> #include <ColorConstants.au3> #include <InetConstants.au3> #include "WinHttp.au3" #include <Network.au3> #include <StringConstants.au3> #include <File.au3> #include <Misc.au3> #include <GuiComboBox.au3> #include <GUIComboBoxEx.au3> #include <FileConstants.au3> #include <GUIListView.au3> #include <GUITab.au3> #include <GUIListBox.au3> #include <GuiButton.au3> #include <XML.au3> #include <SliderConstants.au3> #include <json.au3> Anything obvious missing as far as you can see? Kind regards, Jan
jantograaf Posted February 20, 2020 Author Posted February 20, 2020 1 minute ago, Nine said: Shouldn't you exit after GUIDelete ? Haha, I missed that line, since it came from the other program (where the drop zone does work). But actually that GuiDelete() should be erased there and will be replaced by the call to the function that will process the dropped file. Thanks anyway 😉
Nine Posted February 20, 2020 Posted February 20, 2020 Well, like M23, it is working fine for me... jantograaf 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
jantograaf Posted February 20, 2020 Author Posted February 20, 2020 So, seems like I've reached the holy grail of (quite basic) programming on your pc's, but not on mine... SCRIPT WORKS. DUNNO WHY. OK THEN. 🤪
jantograaf Posted February 21, 2020 Author Posted February 21, 2020 So, meanwhile, I've tested it here on multiple PC's, and it seems to work on some and not work on others. All of them are Windows 10 x64 however, and they should be configured basically in the same way. Could it be that it has something to do with usernames/permissions? I'm completely baffled right now, this should work without a problem and it doesn't. 😪
Moderators Melba23 Posted February 21, 2020 Moderators Posted February 21, 2020 jantograaf, My machine is also Win10 x64 and as I said earlier, the script ran perfectly for me. But searching for "Win10 drag and drop problem" shows that this a relatively common event, possibly linked to Explorer becoming corrupted during Windows updates. Various sites listed propose fixes - none of those I investigated appear to be likely to damage your machine or your data - so it might be worth trying some of them and seeing if you can resolve your problem. Please let us know if you do find a solution. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Zmy Posted February 21, 2020 Posted February 21, 2020 The script works fine expandcollapse popupGlobal $DD_GUI = GUICreate("DicomDrop",200,200,-1,-1,0x00CF0000,0x00000018) GUISetBkColor(0x030303,$DD_GUI) $DD_GUI_DRAGLABEL = GUICtrlCreateLabel("",0,0,32,32,-1, 0x00100000) $DD_GUI_DRAGIMAGE = GUICtrlCreateIcon(@ScriptFullPath,201,0,0,32,32) $DD_GUI_TITLELABEL = GUICtrlCreateLabel("DicomDrop",50,10,100,20,0x1) GUICtrlSetFont($DD_GUI_TITLELABEL,8,600,0,"Verdana") GUICtrlSetColor($DD_GUI_TITLELABEL,0xFFFFFF) $DD_GUI_CLOSE = GUICtrlCreateButton("X",174,4,24,24,0x8000) GUICtrlSetBkColor($DD_GUI_CLOSE,0x030303) GUICtrlSetColor($DD_GUI_CLOSE,0xFFFFFF) Global $DD_GUI_DROPZONE = GUICtrlCreateLabel("",10,42,180,148) GUICtrlSetState(-1,8) GUICtrlSetBkColor($DD_GUI_DROPZONE,0xC8C9D2) GUISetState(@SW_SHOW) Local $DD_MSG = 0 While 1 $DD_MSG = GUIGetMsg() Select Case $DD_MSG = -3 ConsoleWrite(@CRLF & "Debug -- Closed by GUI_EVENT_CLOSE") DD_EXIT() Case $DD_MSG = -13 If @GUI_DropId = $DD_GUI_DROPZONE Then Local $DroppedFile = @GUI_DragFile GUICtrlSetData($DD_GUI_DROPZONE,$DroppedFile) MsgBox(262144, '', $DroppedFile & @CR & '' & @CR & '' & @CR & '') ;GUIDelete() ConsoleWrite(@CRLF & "Debug -- Dropped file : " & $DroppedFile) EndIf Case $DD_MSG = $DD_GUI_CLOSE ConsoleWrite(@CRLF & "Debug -- Closed by DD_GUI_CLOSEIMAGE") DD_EXIT() EndSelect WEnd Func DD_EXIT() GUIDelete($DD_GUI) Exit EndFunc
ViciousXUSMC Posted February 24, 2020 Posted February 24, 2020 Every time I had a drag/drop problem it came from elevation issues. If the GUI was running as admin and the explorer process was not then it would not have enough permissions to drag a file. If it is working on some machines and not others I wonder if it may be a UAC setting or some other process creating a difference in the rights. You can go so far as to run the GUI as admin, and manually run a file explorer process as admin and it will work, but when they are mixed it creates issues. JoeBar and jantograaf 2
ldub Posted March 27, 2021 Posted March 27, 2021 Il get the same problem, even if I run it as admin. The GUICtrlCreateInput Autoit example give me a blank result.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now