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
250 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
ID: 2693150
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
ID: 2693251
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
ID: 2693269
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
ID: 2694004
Thanks a lot
Yakky
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

Title # Comments Views Activity
not able to insert into temp table 68 156
dog bark java program 15 87
mapBully challenge 6 113
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 73
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

919 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

18 Experts available now in Live!

Get 1:1 Help Now