Thread: ListView controls - Adding items .. What the beep?

  1. #1
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477

    ListView controls - Adding items .. What the beep?

    Alright.

    I'm pretty much on the edge here. I've read everything MSDN has on using and creating and *insert verb here* list view controls, and due to the horrid way the documentation is written(IMO) in some cryptic pseudo-english, I have yet to find what I need.

    Basically, I'm trying to use a list view control in such a manner that it will have a few columns.

    Those columns will contain different items depending on the column they're being put in.

    However, after reading and doing various testing, I've not even managed to add an item to a column. Main confusion lies in the difference between items and sub-items.

    Can someone give me an example or some hints regarding adding elements at position x in column y?

    All help greatly appreciated. I'll be venting my fury by shooting terrorists in call of duty 4.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    http://msdn2.microsoft.com/en-us/lib...s_and_Subitems
    Each item can have one or more subitems. A subitem is a string that, in report view, is displayed in a column separate from the item's icon and label. To specify the text of a subitem, use the LVM_SETITEMTEXT or LVM_SETITEM message. All items in a list-view control have the same number of subitems. The number of subitems is determined by the number of columns in the list-view control. When you add a column to a list-view control, you specify its associated subitem index.
    Searching these boards should turn up a few code examples.

    gg

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Column 1 Column 2 Column 3
    Item 1 Sub-item 1 Sub-item 2
    Etc.

    Also note that you must use Report mode I think it's called to see the columns.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Codeplug:

    As I already said, I've already read all that MSDN has. That which you quoted tells me absolutely nothing. "A subitem is a string that, in report view, is displayed in a column separate from the item's icon and label." - Just what does that mean? *Where* is it displayed in the list view? What column exactly?

    Elysia: Yes, I know about report view. Anyway, Do you mean that there is only one column with items, and all the other columns contain only sub-items?

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It means that a subitem is an item that is not displayed in the column where you put the label and icon. And the column where you do that is the "main" column, or the first one.
    So if you look at my example, it means that sub-item 1 for item 1 appears in column 2, and sub-item 2 appears in column 3, and so on.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by Elysia View Post
    It means that a subitem is an item that is not displayed in the column where you put the label and icon. And the column where you do that is the "main" column, or the first one.
    So if you look at my example, it means that sub-item 1 for item 1 appears in column 2, and sub-item 2 appears in column 3, and so on.
    So not every 'place' in the list has an item - only the left-most column has items, and items in the other columns after that are sub-items of those items, depending on the row they are in?

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Each line has one label and several sub-items. The label appears in column 1, and each subsequent sub-item appears in the column next to its label.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by Elysia View Post
    Each line has one label and several sub-items. The label appears in column 1, and each subsequent sub-item appears in the column next to its label.
    Ah, I see. Thanks.

    Now I just have to get the listview working.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamic adding of Controls
    By WDT in forum C# Programming
    Replies: 5
    Last Post: 04-22-2009, 07:59 AM
  2. HELP!!!!emergency Problem~expert please help
    By unknowppl in forum C++ Programming
    Replies: 9
    Last Post: 08-21-2008, 06:41 PM
  3. HELP!!!!emergency ~expert please help
    By unknowppl in forum C Programming
    Replies: 1
    Last Post: 08-19-2008, 07:35 AM
  4. confused about adding controls to main window
    By terracota in forum Windows Programming
    Replies: 4
    Last Post: 11-24-2004, 12:35 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM