?
Solved

2 or more checkbox in a CListCtrl

Posted on 2003-03-13
6
Medium Priority
?
499 Views
Last Modified: 2013-11-20
Hello

What I’m trying to do is have a CListCtrl with 3 columns (in report view)
One columns with text, the other two columns with a check box.

thx for your help

0
Comment
Question by:funvill
[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
6 Comments
 
LVL 8

Expert Comment

by:gelbert
ID: 8131575
You will have to overwriet OnPaint() on CListCtrl to paint checkboxes in two columns. You may be able to find samples at codeproject.cop or codeguru.com
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8131605

 You will need an Owner Drawn CListCtrl

 He is a sample
 
 http://www.codeguru.com/listview/sel_row.shtml

 During the drawing process you will have to dynmaically add a checkbox to the CListCtrl.

 First determine an ID range for the checkboxes say 0xe000 to 0xf000

 Next, when its time to draw add the checkbox with the CListCtrl as the parent. The CRect cooordinates can be garnered from the OwnerDraw rect. Increment the ID each time you add a Check box.

 Use ON_NOTIFY_RANGE to monitor when a CheckBox has been clicked.

 I don't think there is an example of this around. If this is a solution for you we can help you work through it.







 
0
 
LVL 2

Author Comment

by:funvill
ID: 8132062
re: williamcampbell

thats a little over my head.
i tryed for about 1hr and couldn't get any where.
i need an example.

0
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
LVL 2

Author Comment

by:funvill
ID: 8132577
re: williamcampbell

thats a little over my head.
i tryed for about 1hr and couldn't get any where.
i need an example.

0
 

Accepted Solution

by:
PhilJ1 earned 200 total points
ID: 8155576
Try this, it is what I did.

      http://www.codeproject.com/listctrl/xlistctrl.asp?
      target=xlistctrl

I downloaded the project, copied the XListCtrl and associated files into my directory and used this code.

(I know it is somewhat cheating but I did not have the time and it works. Hans Dietrich is the author.)

m_ListCtrl.SetExtendedStyle( m_ListCtrl.GetExtendedStyle()  | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

m_ListCtrl.InsertColumn(0, "Location", LVCFMT_LEFT, 120);
m_ListCtrl.InsertColumn(1, "Category", LVCFMT_CENTER, 120, 1);
m_ListCtrl.InsertColumn(2, "Threat", LVCFMT_CENTER, 70, 2);

int index;

m_ListCtrl.LockWindowUpdate();     // ***** lock window updates while filling list *****

for(index = 0; index < whatever; index++)
{
    // INSERT INTO LIST CONTROL
    m_ListCtrl.InsertItem(index, Location);
    m_ListCtrl.SetItemText(index-1, 1, Category);
    m_ListCtrl.SetCheckbox(index-1, 2, 1);
}

m_ListCtrl.UnlockWindowUpdate(); // ***** unlock window up

See if that will help.
I know that it is somewhat overkill, but it is a great class. You may want to use other capabilities of the class also.  Hans did a good job.

0
 
LVL 2

Author Comment

by:funvill
ID: 8157056
great just what i wanted thx
0

Featured Post

Industry Leaders: 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: 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…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

752 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