1

I am trying to use a control list with a report view to store a file list on a dialog based application like this:
enter image description here
I have two columns on the control list.

The control list I am using is Single Selection - True
My question is how to select the row by a mouse click.

sflee
  • 1,659
  • 5
  • 32
  • 63
  • 1
    Do you need to distinguish among columns or you just want the click response to be available on the whole line? For the second case you can define its extended style to be Full row Select by using: `SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT);` – sergiol Jul 16 '16 at 14:53
  • 1
    Can you be a bit more specific? That link you posted provides a class to interact with the CListCtrl. I'm not sure what your problem is. – rrirower Jul 16 '16 at 18:34
  • 1
    You have declared `CMyListCtrol m_ListCtrl` and you want to link with ListView control in dialog resource? Override `DoDataExchange`, add `DDX_Control(pDX, IDC_LIST1, m_ListCtrl)` - [see example](http://stackoverflow.com/q/744110/4603670). Usually you don't need to monitor mouse click. There are methods available to monitor selection change, activate, drag & drop, etc. – Barmak Shemirani Jul 16 '16 at 23:13
  • @BarmakShemirani, thanks, I will try to see how to add message to the existing control list, but I still want to know how to use a class that is built as MFC Class DLL. – sflee Jul 16 '16 at 23:25
  • Never mind. It seems you can already use `CListCtrl` methods, so you must have added subclass somewhere, you probably don't need `DDX_Control` – Barmak Shemirani Jul 17 '16 at 01:22

1 Answers1

1

If you just want the click response to be available on the whole line, you can define its extended style to be Full row Select by using:

SetExtendedStyle(GetExtendedStyle() | LVS_EX_FULLROWSELECT);
sergiol
  • 4,122
  • 4
  • 47
  • 81