Multicolumn List Boxes

This is a discussion on Multicolumn List Boxes within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I have a multicolumn list box that I'd like to add columns to and different things to those columns. ...

  1. #1
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183

    Multicolumn List Boxes

    Hi,

    I have a multicolumn list box that I'd like to add columns to and different things to those columns. However, I can't find any info on how to do so, MSDN doesn't even say anything. Can anyone give me some info on how to use these? I found this code on a forum from a long time ago but I have no idea what all of the variables are:
    Code:
    HWND hView = GetDlgItem(hwnd, IDC_MAINLIST);
    GetClientRect(hView,&ClientRect);
    iWidth=(ClientRect.right-ClientRect.left)/NUM_COLUMNS;
    LVColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT ; 
    LVColumn.fmt = LVCFMT_LEFT;
    LVColumn.cx=iWidth;
    LVColumn.pszText = "Column Title"; 
    LVColumn.cchTextMax = lstrlen("Column Title"); 
    LVColumn.iSubItem = 0; 		
    LVColumn.iImage = 0; 		
    LVColumn.iOrder = 0; 		
    ListView_InsertColumn(hView,0,&LVColumn);
    Can anyone help? Thanks.

  2. #2
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    That code is for a listview. It is a different control than a listbox.

  3. #3
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183
    Oh, ok. Thanks. Should I use that instead for my project?

    Ok, found info on MSDN, should be enough, thanks.
    Last edited by mikeman118; 11-04-2007 at 01:18 PM.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    That code looks familiar....

    Quote Originally Posted by Welder View Post
    That code is for a listview. It is a different control than a listbox.
    A listview is 'mostly' a listbox with a different set of 'styles' (ie multi columns).
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help sorting a linked list. Beginner
    By scarlet00014 in forum C Programming
    Replies: 1
    Last Post: 09-27-2008, 06:16 PM
  2. help! Placement of nodes in a Linked List
    By lostmyshadow in forum C Programming
    Replies: 6
    Last Post: 12-17-2007, 12:21 PM
  3. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  4. Linked list with two class types within template.
    By SilasP in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2002, 05:13 AM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21