Thread: using TlistVIew

  1. #1
    Registered User
    Join Date
    Apr 2007

    using TlistVIew

    I am new to C++ programming at and currently i am
    using C++ builder...

    can you guys help me to create and format TListView dynamically.
    I will create and format it through code...

    the output would look something like this...

    No.        Header1   Header2 ......  Header5
    1              1        2               5
    2              2        3               6  
    10             10       11             14
    thnx guys...
    Last edited by ysabelle; 04-22-2007 at 05:53 AM.

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Post an attempt first, then people can comment, make suggestions ect
    Double Helix STL

  3. #3
    Registered User
    Join Date
    Apr 2007
    currently i am still trying to create it dynamically thru the code

    TListView* pListView;

    i have this statement both in the .cpp and the .h
    but i am encountering errors.

    please assist in helping me create it dynamically.
    help in builder is not showing how to dynamically
    create a TListView.


  4. #4
    Registered User
    Join Date
    Apr 2007
    I am trying to make a ListView dynamically.
    i patterned my code to what is given in the help file
    however when i execute the code, nothing is displayed
    on the form (blank form)
    what could be missing in my code... please help.

    void __fastcall TForm1::FormCreate(TObject *Sender)
      TListItem  *pListItem;
      TListColumn *pNewColumn;
      TListView *pListView;
      const char Names[6][2][10] =
        {"Michael", "Johnson"},
        {"Bunny", "Bugs"},
        {"Silver", "HiHo"},
        {"Simpson", "Bart"},
        {"Squirrel", "Rocky"}};
      TListView   *pListView = new TListView(this);
      pListView->Parent = this;
      pListView->Align = alClient;
      pListView->ViewStyle = vsReport;
      pNewColumn = pListView->Columns->Add();
      pNewColumn->Caption = "Last";
      pNewColumn = pListView->Columns->Add();
      pNewColumn->Caption = "First";
      for (int i = 0; i < 6; i++)
        pListItem = pListView->Items->Add();
        pListItem->Caption = Names[i][0];

  5. #5
    Registered User
    Join Date
    Apr 2007
    i fixed my problem with TListView...
    i am able to create it as well as format and write
    the column and row headers...

    now, how do i put the actual data....
    what propoerty of TListView do i need to use?
    is it Item ????

    if anyone can teach me the syntax.. it would be
    a great help...

    thnx in advance...

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    I imagine you go back to the manual, and find out what other methods there are besides Add()
    > pListItem = pListView->Items->Add();
    which implements the functionality you want.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed