Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
280 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

721 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