Jump to content

What could prevent a drop handler from getting events?


Recommended Posts

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 by Mbee
Link to comment
Share on other sites

  • Moderators
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?

"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

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

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

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...