c++ - How to mark a list control item as selected? -


In a Win32 application I have a dialog with a list control that is defined as the dialog template:

  controls "", IDC_LIST_Attributes, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP, 7,36,246,110  

At the runtime I retrieve the handle in that control and take various actions with it - remove all items, add items, etc. It works fine.

The problem is that I can not programmatically mark a program as selected, I use the following code for it:

  LVITEM lvItem; LvItem.stateMask = StateMask; LvItem.state = State; SendMessage (windowhandle, LVM_SETMTT, inductatectalect, (LARAPAM) and LVIT);  

This code runs and there is no change in the list control. When I clice on items with a mouse, their selection is fine. What am I missing?

Have you tried?

From the MSDN link:

The items will only be shown as selected if the list-view control is Focus or LVS_SHOWSELALWAYS style is used.

My help.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -