Jump to content
Sign in to follow this  

Trouble with _GUICtrlListView_SubItemHitTest

Recommended Posts


I'm having trouble with _GUICtrlListView_SubItemHitTest, it reports the top left cell of my ListView as item 7, subitem 3.

It then procedes to work correctly (but reporting the offset values) with all but the last 3 columns, and all but the last 7 rows.

Clicking the last three columns, will report item = -1 and subitem = -1. If I scroll to the bottom of the list, the last seven lines will report item = -1 and the correct subitem, except once again, the last 3 columns return -1/-1.

I'm hoping not to have to chop up 1000 lines of code to provide an example with just my GUI/ListView and WM_NOTIFY.

I've already commented out all my $NM_CUSTOMDRAW and $LNV_ENDSCROLL code to where WM_NOTIFY basically a match to that in the _GUICtrlListView_SubItemHitTest example. I don't think I'm doing anything too exotic in my ListView.

So, would anyone know why, or have run across a situation where, _GUICtrlListView_SubItemHitTest will return offset positions and make the columns on the end, and rows on the bottom, inaccessable by the same amounts as the initial offset?


Share this post

Link to post
Share on other sites

Do you use the correct mouse coords? They have to be relative to the Listview-Position, not Window or Screen.

Just try and use the command without coords and use a tooltip in a loop to display the item under Mouse.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post

Link to post
Share on other sites

I thank you both very much. I intended to investigate both suggestions, and decided Gary's would be the quickest to implement. That got me back at the GUICreateListView statement looking at Control Styles and Extended Styles. I decided to make sure mine were identical to the _GUICtrlListView_SubItemHitTest example.

Lo and behold, when looking at the example I noticed a line I somehow glanced over previously, there is a:

$hListView = GUICtrlGetHandle($hListView); get the handle for use in the notify events

immediately after the define of the ListView. I'd omitted this seemingly "do-nothing" statement. It obviously does something, as inserting it into my script fixed me right up. It must "reset" the ListView handle somehow...

Thank you both for getting me looking in the right direction.

... typos, as usual...

Edited by Spiff59

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.