cyprus106
Programmer
- Apr 30, 2001
- 654
I've got a ListView with 4 existing columns. When I create the data for the LV, in runtime, from a table, I add 7 subitems worth of data, and just don't have those extra four columns. The user can't actually see the last 4 subitems of data. The ListView is in vsReport style... Now I want to be able to show/add and remove/hide columns on the fly. Say I've got these columns VISIBLE:
Name
Phone Number
Tag
Total
And the 'invisible Columns', there's:
Vehicle
Labor Price
Purchases
Date
I'd SWEAR I've done this before but I can't find ANY code on how... Maybe I'm just blind, but I fail to see a method of doing this! My explaination may be a bit confusing, so here's my code to add an item to the list:
Now, in the ListView, there's only 4 columns that I've created in design time: Name, Phone, Tag, Total... Now I want to be able to hide and show those and the other 4, Vehicle, Labor, Purchases, and Date in runtime. I hope I explained this well enough. Thanks a lot for any help!!
Cyprus
Name
Phone Number
Tag
Total
And the 'invisible Columns', there's:
Vehicle
Labor Price
Purchases
Date
I'd SWEAR I've done this before but I can't find ANY code on how... Maybe I'm just blind, but I fail to see a method of doing this! My explaination may be a bit confusing, so here's my code to add an item to the list:
Code:
ListItem = CustListView->Items->Add();
ListItem->Caption = /* customer's name */
/* these are visible from the ListView */
ListItem->SubItems->Add(MainForm->CtTable1->FieldByName
("cust_phone")->AsString); ListItem->SubItems->Add(MainForm->CtTable1->FieldByName
("tag")->AsString); ListItem->SubItems->Add(MainForm->CtTable1->FieldByName
("total")->AsString);
/* these are not */
ListItem->SubItems->Add(MainForm->CtTable1->FieldByName
("vehicle")->AsString);
ListItem->SubItems->Add(MainForm->CtTable1->FieldByName
("labor")->AsString);
ListItem->SubItems->Add(MainForm->CtTable1->FieldByName
("num_purchases")->AsString);
ListItem->SubItems->Add(MainForm->CtTable1->FieldByName
("date")->AsString);
MainForm->CtTable1->Next();
Now, in the ListView, there's only 4 columns that I've created in design time: Name, Phone, Tag, Total... Now I want to be able to hide and show those and the other 4, Vehicle, Labor, Purchases, and Date in runtime. I hope I explained this well enough. Thanks a lot for any help!!
Cyprus