Re: How to listen to multi-item selection with wxListCtrl

Andreas Falkenhahn <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
On 29.08.2023 at 19:47 Andreas Falkenhahn wrote:

> Actually, just adding an additional listener for wxEVT_LIST_ITEM_FOCUSED
> did the trick for me but I only need a solution that works on MSW. 

Hmm, actually, I have now found some cases where listening to 
wxEVT_LIST_ITEM_FOCUSED doesn't do the job. But there's not really
anything that could be done about it because it's caused by weird
behaviour of Windows' ListView widget.

For some reason, Windows sometimes sets the iItem of the NMLISTVIEW
structure to -1 when it sends an LVN_ITEMCHANGED message even though
the message is clearly sent in response to selecting an item with
shift+LMB. When doing so, the clicked item is correctly added to the
selection in the listview widget but still the listview receives an 
LVN_ITEMCHANGED message with iItem set to -1 :(

It only happens in certain situations and I don't understand why
it does but it's clearly reproducible and of course it renders the
wxEVT_LIST_ITEM_FOCUSED workaround useless because it doesn't work
in all cases... sucks, but looks like a Windows problem.

-- 
Best regards,
 Andreas Falkenhahn                            mailto:[email protected]

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/1667226010.20230831154221%40falkenhahn.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.