ListView is not working!

This is a discussion on ListView is not working! within the Windows Programming forums, part of the Platform Specific Boards category; When I put this code under my WM_CREATE area, the listview is displayed as a big empty white client-edged box. ...

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534

    ListView is not working!

    When I put this code under my WM_CREATE area, the listview is displayed as a big empty white client-edged box. Why is this not making the columns?
    Code:
             InitCommonControls();
             CreateCtrl(WC_LISTVIEW, NULL, WS_VSCROLL, WS_EX_CLIENTEDGE, ID_LIST, 0, 0, 0, 0);
             lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
             lvColumn.fmt = LVCFMT_LEFT;
             lvColumn.cx = 100;
             lvColumn.pszText = "File Name";
             ListView_InsertColumn(GDI(ID_LIST), 0, &lvColumn);
             ListView_Update(GDI(ID_LIST), 0);
             lvColumn.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
             lvColumn.fmt = LVCFMT_LEFT;
             lvColumn.cx = 100;
             lvColumn.pszText = "File Size";
             ListView_InsertColumn(GDI(ID_LIST), 1, &lvColumn);
             ListView_Update(GDI(ID_LIST), 1);
    CreateCtrl() is a working macro I made. So is GDI(). And I have the program set the size of it under WM_SIZE, which is also working great. I have already tried it with and without the update calls.

    EDIT:
    I changed ListView_SetColumn() to ListView_InsertColumn() but it's still not working. Please help.

    EDIT 2:
    Okay, nevermind, I see now. I was under the impression that the "SysHeader32" class was a part of the "SysListView32" class. Sorry for the bunk thread.
    Last edited by Yarin; 09-02-2007 at 10:20 AM.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  2. #2
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    Okay now I have a question. How do I put items under other columns? By defualt it keeps placing them in the first one. (I'm using ListView_InsertItem().)
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  3. #3
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    307
    See ListView_SetItem
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    ListView_InsertItem() can do anything ListView_SetItem() can. Regardless though, I have already checked it out, how do I use it to place text under other coloumns??
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  5. #5
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    Oh nevermind, I see what you mean; thanks for the help Joelito!
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ListView & ImageLists
    By @nthony in forum Windows Programming
    Replies: 2
    Last Post: 07-16-2006, 04:44 PM
  2. Replies: 6
    Last Post: 07-10-2006, 12:05 AM
  3. Troubles with ListView and Toolbar
    By cornholio in forum Windows Programming
    Replies: 8
    Last Post: 11-14-2005, 12:26 AM
  4. Problems setting selection in listview window
    By PJYelton in forum Windows Programming
    Replies: 4
    Last Post: 04-12-2005, 07:37 PM
  5. Listview with c/c++
    By X PaYnE X in forum Windows Programming
    Replies: 8
    Last Post: 03-20-2005, 10:29 PM

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