clistctrl

CListCtrl select multiple lines with the mouse

你说的曾经没有我的故事 提交于 2020-01-04 15:25:22
问题 There is a CListCtrl with SetExtendedStyle (LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT) , a single selection is false. I want to be able to select multiple lines with the mouse. When starting selection from an empty area, it works: It does not work if I start the selection not from an empty area. Selection frame does not appear: How to make it work? 回答1: It is not really a good idea to change how a common control works because users expect them to function like they do in all other applications.

How to detect a CListCtrl selection change?

落爺英雄遲暮 提交于 2019-12-28 16:30:35
问题 I want to execute some code when the user selects a row in a CListCtrl (report view, I don't care about the other viewing modes). How do I catch this event? is there some message I can map or a method like "OnSelectionChanged" or something like that? 回答1: Also try: BEGIN_MESSAGE_MAP(cDlgRun, CDialog) ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2) END_MESSAGE_MAP() /* ... */ void cDlgRun::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*

How to add checkboxes in multiple columns in VC++

杀马特。学长 韩版系。学妹 提交于 2019-12-24 21:49:32
问题 I am new to the Visual C++, I am using Visual C++ 2005, I want to show some records in report where I am using ListControl . My single entry of records contains two boolean fields so that each row in the ListControl are to be represented with the Check boxes. In short there will be two checkboxes in each row. I used the ListControl but I found that there comes only one checkbox for each entry. So can anybody please explain how I can add multiple columns of checkboxes in ListControl , also

CListCtrl - how to enable multiple selection

本秂侑毒 提交于 2019-12-24 10:11:31
问题 I am creating a MFC application for Windows Mobile and don't know how to enable multiple selection for List Control (CListCtrl). In properties panel Single Selection is set to False but still can't select multiple items. Any idea? 回答1: I have never targeted Windows Mobile but you might try the following: list.ModifyStyle(LVS_SINGLESEL, 0); 回答2: ModifyStyle method of CWnd base will work (see post from Diego) if you desire to do this programmatically OR you can define the attribute within the

CListCtrl: How to maintain horizontal scroll position?

╄→гoц情女王★ 提交于 2019-12-23 18:28:31
问题 How can I maintain the horizontal scroll bar position of a CListCtrl? I periodically dump and repopulate the contents of the list control so without explicitly remembering the old position and restoring it the scroll just goes back to the top left. I asked a related question, CListCtrl: How to maintain scroll position?, earlier but at the time I was only interested in vertical scroll position and the answer supplied solved that. However, now I want to remember and restore the horizontal

CListCtrl: How to maintain scroll position?

旧街凉风 提交于 2019-12-19 05:33:13
问题 I have a CListCtrl (report style) where I clear the list and repopulate it at certain times. I'd like to maintain the vertical scroll position when doing this. I see there are a couple methods that look promising: EnsureVisible() GetScrollPos() SetScrollPos() GetScrollInfo() GetTopIndex() Scroll() I'm trying GetScrollPos() and then SetScrollPos() but it doesn't appear to be working. What is the simple correct way to save a scroll position and then later restore it? UPDATE Actually it seems I

CListCtrl: How to maintain scroll position?

丶灬走出姿态 提交于 2019-12-19 05:33:03
问题 I have a CListCtrl (report style) where I clear the list and repopulate it at certain times. I'd like to maintain the vertical scroll position when doing this. I see there are a couple methods that look promising: EnsureVisible() GetScrollPos() SetScrollPos() GetScrollInfo() GetTopIndex() Scroll() I'm trying GetScrollPos() and then SetScrollPos() but it doesn't appear to be working. What is the simple correct way to save a scroll position and then later restore it? UPDATE Actually it seems I

CListCtrl with checkboxes questions

这一生的挚爱 提交于 2019-12-18 09:44:06
问题 The List Control is defined as Single Selection on the resources. Question 1 I want to have a checkbox on the header of first column of my CListCtrl . On the OnInitDialog I have m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); CString s; s.LoadString(IDS_COLUMN1); #ifndef HDS_CHECKBOXES // Copied from Microsoft SDKs\Windows\v7.0A\Include\CommCtrl.h #define HDS_CHECKBOXES 0x0400 #endif CHeaderCtrl& header = *m_list.GetHeaderCtrl(); header

Get Column Order (MFC)

我与影子孤独终老i 提交于 2019-12-13 17:22:07
问题 I'm trying to get the order of the columns in an MFC CListCtrl . Initially I tried calling GetColumnOrderArray() in a message handler for the HDN_ENDDRAG notification, but that always returned the old (pre-drag and drop) column order. So, based on the advice in this SO post's comment, I tried handling both the HDN_BEGINDRAG and the HDN_ENDDRAG and grabbing the old and new column orders with phdr->pitem->iOrder . But pitem is always NULL for me in the both handlers. No idea why. SOOO I tried

How to determine if a scrollbar for a CListCtrl is displaying?

社会主义新天地 提交于 2019-12-13 03:36:38
问题 I have a class that is derived from a CListCtrl. I want the widths of all the columns to total the width of the display Window, so that I don't get the bottom scrollbar. I can get the width of standard scrollbars vai the GetSystemMetrics(SM_CXVSCROLL) call, but I don't know how to tell if the vertical scrollbar is active. I've tried to use: auto pScrollbar = GetScrollBarCtrl(SB_VERT); auto is_visible = pScrollbar && pScrollbar->IsWindowVisible(); But pScrollbar is always a nullptr . I've