Sign in to follow this  
Followers 0
Spaghetti prog

Disable drag and drop in listview

4 posts in this topic

I am using the WM_Notify routine to track click event in a listview and so store the selected item.

However if a users clicks an item and slightly moves the mouse while clicking (in fact starts an unwanted drag and drop), the click event is not registered.

Is there a way to prevent the embeded drag and drop feature of the listview control (did not found answer in TFM!) or if not, is there a way to notify drag and drop event so i can track the selected item?


goto is evil

Share this post


Link to post
Share on other sites



I am using the WM_Notify routine to track click event in a listview and so store the selected item.

However if a users clicks an item and slightly moves the mouse while clicking (in fact starts an unwanted drag and drop), the click event is not registered.

Is there a way to prevent the embeded drag and drop feature of the listview control (did not found answer in TFM!) or if not, is there a way to notify drag and drop event so i can track the selected item?

If you used Case $GUI_EVENT_PRIMARYDOWN to detect the mouse button down then you would detect it for a click and for a short unintended drag.

You could then find out if the click was over a listview item and store that.

That way you don't need to worry about whether drag drop is enabled or not, and itcould be simpler than using WM_NOTIFY.

If it is of interest, and you need more info I can make a quick example.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I thought WM_NOTIFY was the only way to correctly poll this control.

I should give a try at $GUI_EVENT_PRIMARYDOWN alternative

Thank you for your help


goto is evil

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I take it you're catching NM_CLICK in your WM_NOTIFY function? Then you should also catch LVN_BEGINDRAG. Getting the selected item is pretty much identical in both cases. And if you want to disable dragging when you're done just use Return.

If you have problems, post your WM_NOTIFY function.

Edited by Siao

"be smart, drink your wine"

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