Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

2 or more checkbox in a CListCtrl

Posted on 2003-03-13
6
Medium Priority
?
519 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
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

578 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