Highlight Row w/ CListCtrl

Posted on 1999-06-29
Medium Priority
Last Modified: 2013-11-20
I'm using VC++ 5.0 and have a dialog based app/ with a List Control Box.  I want to be able to highlight an entire row when it's selected.  Right now only the first column is lit.  I've been out to codeguru and those samples all seem to deal with a CListView class written for a SDI app.  Plus it seems like an awful lot of code just to highlight a row.  Is it necessary to create a subclass using CListView, if so I'm not sure how to integrate it with my app.  Also, I'm not using any icons(images) in my report view CListCtrl if that will make coding any easier.  It seems like this should be an easy answer if anyone has some sample code they can post.  Hopefully, my objective can be met while staying in my Dialog class and not have to create a CListView class.
Question by:halen
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
  • 2
LVL 23

Accepted Solution

naveenkohli earned 280 total points
ID: 1308404
Add this code in your OnInitdialogBox function.

CMyDialog::OnInitDialog ()

// Add LVS_EX_FULLROWSELECT to list control style so clicking
      // on any part of the list selects the whole row.
CWnd *pWnd = GetDlgItem (IDC_LIST1);


Author Comment

ID: 1308405
Excellent!  That appears to really hit the spot.  That looks to be an undocumented feature since I couldn't find any info on LVS_EX_FULLROWSELECT or LVM_GETEXTENDEDLISTVIEWSTYLE.
LVL 23

Expert Comment

ID: 1308406
Its true helen..
i also learnt it the hard way.... going down the bowls of MFC source code ..

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

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 …
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

719 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