Nested rows, is this possible?

General TRichView support forum. Please post your questions here
Post Reply
reiser
Posts: 25
Joined: Sat Jun 25, 2011 8:40 am

Nested rows, is this possible?

Post by reiser »

Hello, I have something like this:

Image

I want to make yellow row nested in a green one, so its not visible until I expand the green row. Is something like this possible? Like a subrow inside a row.

This is how I add the row:

Code: Select all

  table := TRVTableItemInfo.CreateEx(1, 3, rvLog.RVData);
  with table do
  begin
    BorderWidth := 0;
    CellVPadding := 0;
    CellBorderWidth := 0;
    CellVSpacing := 0;
    BorderVSpacing := 0;
    Color := clNone;
    BestWidth := 0;
    Options := [rvtoRTFAllowAutofit];

    Cells[0, 0].BestWidth := 75;
    Cells[0, 1].BestWidth := 50;

    Cells[0, 0].Clear;
    Cells[0, 1].Clear;
    Cells[0, 2].Clear;

    Cells[0, 0].AddFmt('%s', [ATime], 0, 0);
    Cells[0, 1].AddFmt('%s', [ATypeStr], ATypeStyle, 1);
    Cells[0, 2].AddFmt('%s', [AData], ADataStyle, 2);
  end;

  rvLog.AddItem('', table);
Thanks!
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Is each row a separate table?
reiser
Posts: 25
Joined: Sat Jun 25, 2011 8:40 am

Post by reiser »

Yes.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can use "hidden text" feature.
To hide a table, assign a non-zero value to its rvepHidden property (using SetItemExtraIntProperty method) and format the document.

There is a demo for expanding/collapsing content using hidden text:
http://www.trichview.com/forums/viewtop ... t=62#25058

Comparing to your case:
- this demo uses OnJump event to expand/collapse. You can use OnRVMouseUp event. It's not necessary to use GetItemAt in this event, you can use ItemNo parameter (when clicking inside a table, ItemNo is an index of this table)
- this demo checks expanded/collapsed state depending on the image of the hotspot; you will need to check rvepHidden property of the next table
- this demo has code for hiding a range of text; for your task, it is enough to set rvepHidden property for an item.
reiser
Posts: 25
Joined: Sat Jun 25, 2011 8:40 am

Post by reiser »

Thanks a lot, that worked.
Post Reply