Thread: Control List box (Report)

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    4

    Unhappy Control List box (Report)

    Hi,

    I have implemented a Control List box (report) in a c application using win32 api....
    The problem is:-
    When you add details to the control list box it adds them to the top of the list.....

    Eg...

    Item
    -----------------
    Item 4
    Item 3
    Item 2
    Item 1

    I would like it to add the item to the bottom of the list so I get:-

    Item
    ------------------
    Item 1
    Item 2
    Item 3
    Item 4

    Is there an easy way of doing this?

    Cheers,
    Matt

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Remove all sorting styles.

    Use owner draw if still having a problem. Are you specifing the row and column to insert item struct? (Column, row is zero based)

    Code:
    void	FillLVItem(HWND hListView, int Row, int Column, char* sDescription)
    {
    //rows are new item, coloumns relate to each other
    	LV_ITEM			Item;
    
    	Item.mask=LVIF_TEXT | LVIF_PARAM;
    	Item.iItem=Row;
    	Item.iSubItem=Column;
    	Item.state=0;
    	Item.stateMask=0;
    	Item.pszText=sDescription;
    	Item.cchTextMax=STRING;
    	Item.iImage=0;
    	Item.lParam=Row;
    	if(Column>0)
    		ListView_SetItemText( hListView, Row, Column, sDescription);
    	else
    		ListView_InsertItem( hListView, &Item);
    "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. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  2. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  3. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  5. 1st Class LIST ADT
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 11-09-2001, 07:29 PM