Solved

Header in a CListView?

Posted on 1998-09-24
1
303 Views
Last Modified: 2013-11-19
Hi,
I have used the class ClistView to display data in
a report view style.
I have tried to catch the message LVN_COLUMNCLICK
to test whether I have click the header or not.
Now, I want to know whether the first header,second header,
third header,etc had been clicked.
Now I cannot get the no. of column which had been clicked.
How can I get this?

Thanks
P.S. I haven't used the class CHeaderCtrl until now.
0
Comment
Question by:kkuu
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 40 total points
ID: 1322556
You don't need to add you're own header control, there's one built into the list control for report view (it is a header control wndow which is a child of the list, a bit like the edit control built into combo boxes, or the scroll bars built into multi line edit controls)

You get the column number click as part of the LVN_COLUMNCLICK notification sent to your listctrl, here's how

void CTComply::OnColumnclickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
      NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;

      int nColumnClicked = pNMListView->iSubItem ;

              // Add code here, nColumnClicked is the column number

      *pResult = 0;
}

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now