Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Listview problem

  • 29-01-2003 02:45PM
    #1
    Registered Users, Registered Users 2 Posts: 950 ✭✭✭


    Hello All

    I have a small problem where I am trying to read data from a 4 column listview set to report style if someone could give me a code example on how to read more than the first column (preferably all columns) I would be grateful.
    the programming language is borland c++ builder 4:cool:


Comments

  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    How is the listview created? "Raw" Windows listview, "Raw" listview from some other OS, or a framework class?


  • Registered Users, Registered Users 2 Posts: 2,157 ✭✭✭dazberry


    Jessy

    Since you're using C++ Builder 4 I'm guessing you're using the VCL. Its about 6 yrs (!!! - I didn't realise it was so long until now - f) since I've done any C++, but from the VCL point of view, the following will get you on the right track (in Delphi). I guess, replace := with = and . with -> (don't quote me on it) and all the other bits ;)

    var
    LI : TListItem;
    begin
    LI:=ListView1.Items[0];

    Label1.Caption:=LI.Caption;
    Label2.Caption:=LI.SubItems.Strings[0];
    Label3.Caption:=LI.SubItems.Strings[1];
    Label4.Caption:=LI.SubItems.Strings[2];
    end;

    Things to note.

    Subitems is of type tStrings, so Subitems.count, Subitems[index] / Subitems.strings[index], Subitems.objects[index] etc. are all valid. So all those "rules" (ignored above) apply.

    HTH

    D.


Advertisement