2 or more checkbox in a CListCtrl

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

LVL 2
funvillAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gelbertCommented:
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
williamcampbellCommented:

 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
funvillAuthor Commented:
re: williamcampbell

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

0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

funvillAuthor Commented:
re: williamcampbell

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

0
PhilJ1Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
funvillAuthor Commented:
great just what i wanted thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.