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
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

627 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