Re: Programmatically selecting in a ClistCtrl

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Pierre Couderc (pierre_at_couderc.ccNOSPAM)
Date: 12/29/04


Date: Wed, 29 Dec 2004 20:13:03 +0100
To: "Doug Harrison [MVP]" <dsh@mvps.org>

Thank you, but it is not enough.
I have tried with
m_pListCtrl->SetItemState(First,LVIS_SELECTED | LVIS_FOCUSED ,
                        LVIS_SELECTED|LVIS_FOCUSED);
but something else is missing.

Pierre Couderc

Doug Harrison [MVP] wrote:

> Pierre Couderc wrote:
>
>
>>I want to select from item1 to item2 of a list in report mode.
>>It is easy with the shift+LeftClick mouse.
>>
>>NOW, I want to programmatically preset item1, so that the user can
>>shift-click in item2 and get item1-item2 selected.
>>
>>Is there a way to do that?
>>
>>The problem is to simulate a previous click in item1, so that it is
>>memorised in ClistControl (or underlying Win32 control).
>>
>>I have made trials with SetItemState. But the CListCtrl keeps in memory
>>the item where thsu user has truly clicked....
>
>
> You need to give the item the LVIS_FOCUSED state.
>