Help with CListBox Multi-column with checkbox
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Help with CListBox Multi-column with checkbox

Threaded View

  1. #1
    Join Date
    Oct 2005
    Posts
    27

    Help with CListBox Multi-column with checkbox

    Hi All,

    Firstly I've managed to put together a mockup image of what I'm after, it's attached and what I have with code so far is below.

    I'm not particlurly fluent in C++ but a fast learner. The following is what I am attempting to achieve:
    1. I'm trying to create this multiple column List with checkboxes in the second column of the items.
    2. Where the second column heading is I'd like to place a image instead of text.
    3. How to check these boxes.
    4. How to disable the boxes.

    Any help is greatly appreciated!
    Hayden


    m_myListControl.InsertColumn(1,"Layer",LVCFMT_LEFT,50);
    //******Somehow here insert column heading with image *******
    //m_myListControl.InsertColumn(2,??An image??LVCFMT_LEFT,50);
    //**********************************************
    m_myListControl.InsertColumn(3,"Zoom",LVCFMT_LEFT,50);
    m_myListControl.InsertColumn(4,"Labels",LVCFMT_LEFT,50);
    m_myListControl.SetColumnWidth(0,200);
    m_myListControl.SetColumnWidth(1,20);
    m_myListControl.SetColumnWidth(2,100);
    m_myListControl.SetColumnWidth(3,100);

    CString strText;

    // Insert 10 items in the list view control.
    for (int i=0;i < 10;i++)
    {
    m_myListControl.InsertItem(LVIF_TEXT|LVIF_STATE, i, "Layer Title", 0, 0, 0, 0);
    //*******here somehow add a checkbox on the second column******
    m_myListControl.SetItemText(i, 1, "CHECKBOX");
    //*******************************************************
    m_myListControl.SetItemText(i, 2, "'WS Point: '+AssetType");
    m_myListControl.SetItemText(i, 3, "(0, 10000)");

    //*******On the 5th item check checkbox and disable it******
    if (i = 4)
    {
    //I know this isn't right but hopefully you'll see what mean
    m_myListControl.SetCheck(2,1);
    m_myListControl.SetDisabled(2,1);
    }
    }
    Attached Images Attached Images  
    Last edited by ill_comms; March 16th, 2009 at 09:48 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center