Mbee Posted May 3, 2019 Share Posted May 3, 2019 (edited) One of my GUIs has multiple places where a user can drop a file-system element, almost always a folder will be dropped there. All those controls have $GUI_DROPACCEPTED set. But only one of them sees drop events, the dropping anything on the rest of them is never recognized by the drop handler, which is the same for all of these controls. What could be preventing these drops from being recognized? Please don't ask for code -- I don't want to paste 11 thousand lines of it! Just spitball some things that might prevent a drop even from being recognized at all. One thing I might suspect would be if Event Mode was turned off, but that seems impossible since drops on the one drop area that is recognized continues to work perfectly. Any ideas, folks? Thanks Edited May 4, 2019 by Mbee Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 4, 2019 Moderators Share Posted May 4, 2019 3 hours ago, Mbee said: Please don't ask for code -- I don't want to paste 11 thousand lines of it! Then you should be able to post a snippet that reproduced your issue. You are asking members of this forum to first guess at what you are doing and then troubleshoot for you. Kind of a big ask with only the most vague description to go off of, isn't it? FrancescoDiMuro, supraaxdd and Earthshine 3 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Mbee Posted May 4, 2019 Author Share Posted May 4, 2019 Why the abuse? Why can't you put yourself in my shoes and understand that there's no fraggin way in hell to isolate "snippets" of where within 11,000 lines of code something isn't right? Can't you understand general questions? Must you have exact code to even think? Your type would make me hate to even ask questions here if it weren't for so many vastly superior posters. Link to comment Share on other sites More sharing options...
Moderators Popular Post Melba23 Posted May 4, 2019 Moderators Popular Post Share Posted May 4, 2019 Mbee, I see no abuse in that post, merely a sensible comment that asking us to guess what might be the cause of a specific problem in a very large script is not really a reasonable thing to do. Your comment about being asked to isolate "snippets" of code is exactly what you are asking us to do - but without even sight of the code, which makes it several orders of magnitude more difficult. I suggest you extract the following code from your magnum opus: The GUI (including the various controls on which you want to drop) and the basics of the handler you use to recognise a drop - plus sufficient other lines to make it actually runnable. We do not need all the fancy functions etc - just the bare bones code. Then we can see if there is something fundamentally wrong with the way in which you are coding the whole process - or whether the problem lies elsewhere in these thousands of lines. This incremental approach is the only sensible manner to manage such a problem, so please cool down and help us to help you. M23 Earthshine, Exit, yutijang and 2 others 5 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 Link to comment Share on other sites More sharing options...
Mbee Posted May 9, 2019 Author Share Posted May 9, 2019 It's not possible to isolate what I could be doing wrong in this regard because I was NOT doing anything wrong! At least according to the AutoIt documentation. The correct answer to the question "What could prevent a drop handler from getting events?" is: Having $WS_EX_ACCEPTFILES enabled! Yes, it works perfectly as long as I absolutely ensure that none of the controls I wish to drop file-system objects onto has $WS_EX_ACCEPTFILES turned on. I've now confirmed this dozens of times. Before I learned this inexplicable fact, I ran WinSpy64 and examined the GUI controls where the drops kept getting ignored. If $WS_EX_ACCEPTFILES was set, it always failed. And since WinSpy64 allows you to alter the Styles and Extended Styles manually while the application is still running, I discovered that turning this off caused my application to work perfectly. So posting any snippets or even posting all 11,000 lines would have been 100% worthless! I'm extremely happy I didn't waste my time! Link to comment Share on other sites More sharing options...
Inpho Posted May 9, 2019 Share Posted May 9, 2019 On 5/3/2019 at 11:00 PM, Mbee said: Just spitball some things that might prevent a drop even from being recognized at all. Incorrect code. Posting your code wouldn't have been worthless; I had the exact same issue last week. Who knows, maybe you made the same mistake I did. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 9, 2019 Moderators Share Posted May 9, 2019 Mbee, Quote I was NOT doing anything wrong! At least according to the AutoIt documentation But you were. The $WS_EX_ACCEPTFILES extended style applies to the GUI, not the controls themselves - they need to be the $GUI_DROPACCEPTED state. So by applying the unneeded style value to the controls you are arbitrarily changing their extended style to some unexpected value which appears to prevent the drop being accepted. Quote Before I learned this inexplicable fact Which is in fact explained in many places in the Help file - see the explanation for the extended styles under GUICreate: Quote $WS_EX_ACCEPTFILES Allow an edit or input control within the created GUI window to receive filenames via drag and drop. The control must have also the $GUI_DROPACCEPTED state set by GUICtrlSetState(). for other controls the drag&drop info can be retrieved with @GUI_DragId, @GUI_DragFile, @GUI_DropId. Or in the pages for GUICtrlCreateInput and GUICtrlCreateEdit: Quote If you want to drag & drop a filename onto this control just add the WS_EX_ACCEPTFILES extended style on the GUICreate() and set the state to $GUI_DROPACCEPTED. Had you done what I suggested above and posted just the bare bones of the GUI and handler code this would have been immediately obvious and you could have saved yourself a lot of work. But you just go ahead and blame us for your error if it makes you feel better. M23 supraaxdd and JLogan3o13 2 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 Link to comment Share on other sites More sharing options...
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