Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

TableGrid in dynamic reports

edited April 2015 in General
I am exploring the use of the TableGrid component (RB15, corporate
purchasing is working on an updated license) in reports where the
construction must be dynamic, to deal with user options. I have
observed that in a TableGrid with more than one row, when I place in a
cell a TppLabel, for example, and want it in the second row of the
grid, I must assign the Top parameter based on the position in the
band, not in the cell.

So in a label placed in row 0, I will assign:
ALabel.Top := 0.0;

But for row 1, I write:
ALabelTop := MyGrid.Rows[0].Height;

Is this correct, or have I missed something about how to use the
TableGrid dynamically? I have looked for demos with the TableGrid, but
have not found any.

Thanks,

Bill Meyer

Comments

  • edited April 2015
    Hi Bill,

    You posted about creating grids dynamically on April 4 and I provided an
    example. In that example I used the Label.Anchors to position the Label
    within the Row like this:

    lLabel := TppLabel.Create(self);
    lLabel.Caption := Table1.FieldDefs[liIndex].Name;
    lLabel.Parent := ppTableGrid1.Cells[1,liIndex];
    lLabel.Anchors := [atLeft, atTop, atRight];

    If you don't want to use Anchors, you can set the Label.Top like this:

    lLabel := TppLabel.Create(self);
    lLabel.Caption := Table1.FieldDefs[liIndex].Name;
    lLabel.Parent := ppTableGrid1.Cells[1,liIndex];
    lLabel.Anchors := [atLeft, atRight];
    lLabel.Top := ppTableGrid1.Rows[1].Top + myOffset;



    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2015
    Nard Moseley (Digital Metaphors) wrote:


    Nard,

    Thanks, you're right, I did post, and you did give an example. What
    was not clear to me then, and is still not clear is why when I place,
    for example, a TppLabel in a cell -- in the designer this time -- it
    snaps to the column edges, but seems not to be affected by the row
    boundaries.

    Thanks,

    Bill Meyer
  • edited April 2015
    Hi Bill,

    When a Label is added to a TableCell, the Label.Anchors default to [atLeft,
    atRight]. If you then modify the Label.Anchors to include atTop, then the
    the Label will also snap to the Top.


    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2015
    Nard Moseley (Digital Metaphors) wrote:


    Got it, thanks.

    Bill Meyer
This discussion has been closed.