Page 1 of 1

Nested rows, is this possible?

Posted: Sat May 17, 2014 12:06 pm
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!

Posted: Sun May 18, 2014 10:17 am
by Sergey Tkachenko
Is each row a separate table?

Posted: Sun May 18, 2014 10:58 am
by reiser
Yes.

Posted: Mon May 19, 2014 10:19 am
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.

Posted: Mon May 19, 2014 1:28 pm
by reiser
Thanks a lot, that worked.