Solved

CListCtrl - How do I prevent a user resizing the columns & stop the blue hilighter appearing when an item is clicked on?

Posted on 2000-04-07
4
248 Views
Last Modified: 2013-11-20
CListCtrl -
1. How do I prevent a user resizing the columns?

2. Stop the blue hilighter appearing when an item is clicked on?

I can do this if I invalidate the window, but the windows background becomes greyed. I want a white background.  Any ideas?

Thanks in Advance
Yakky
0
Comment
Question by:yakky
  • 3
4 Comments
 
LVL 8

Expert Comment

by:VinExpert
Comment Utility
Hi,

Not to allow user to resize.

Have Ur own List Control class say CDontResize and associate it with ur list control. Then map the following function

BOOL CDontResize::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{

      HD_NOTIFY *pHDN = (HD_NOTIFY*)lParam;
      {
            if((pHDN->hdr.code == HDN_BEGINTRACKW || pHDN->hdr.code == HDN_BEGINTRACKA)
                        && (pHDN->iItem == 2) || (pHDN->iItem == 3) || (pHDN->iItem == 4) ||
                        (pHDN->iItem == 5) || (pHDN->iItem == 6) || (pHDN->iItem == 7) || (pHDN->iItem == 8))
            {
                  *pResult = TRUE;
                  return TRUE;
            }
      }      
      return CListCtrl::OnNotify(wParam, lParam, pResult);
}

Here I am not allowing the columns 2 - 8 to resize!!!.

Try it out.

VinExpert
0
 
LVL 8

Accepted Solution

by:
VinExpert earned 50 total points
Comment Utility
Hi,

And not to allow to select any row, map the PreTranslateMessage() to that class and add the following code

      if(pMsg->message == WM_LBUTTONDOWN)
      {
            pMsg->message = NULL;
            return 0;
      }

Hope that helps.

VinExpert
0
 
LVL 8

Expert Comment

by:VinExpert
Comment Utility
Hi,

To prevent selection u can map the WM_LBUTTONDOWN message to that class and dont call the base class member. That also will work.

Try it out.

VinExpert
0
 

Author Comment

by:yakky
Comment Utility
Thanks a lot
Yakky
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

17 Experts available now in Live!

Get 1:1 Help Now