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

Set Height of TDBText-Field

edited August 2009 in General
Hi,

within the detailband I have a region.
On this region is a Memofield and a DBText-Field.

The memo can have one or more rows. The region does stretch with the
memo.

How can I set the height of the DBText-Field exactly the height of the
stretching region?

Thanks for your help,
Josef Gschwendtner

--

Comments

  • edited August 2009
    Hi Josef,

    The DBText component is not stretchable so it will not automatically size
    itself vertically. Depending on what you are trying to accomplish, you
    could measure the height of the text inside the memo object before the
    DBText object is created and set it's height accordingly. Another option
    would be to use two regions and have the region with the DBText set to
    StretchWithParent.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2009
    Nico Cizik (Digital Metaphors) wrote:


    Yes that is what I did like to do, but I don't find an appropriate
    event and/or technique to do this.

    Could you give me a hint.

    Josef

    --
  • edited August 2009
    Hi Josef,

    Rather than measure, try using the OnDrawCommandCreate event to determine
    the final height of the memo. Something like the following...

    uses
    ppDrwCmd, ppUtils;

    procedure TForm1.ppMemo1DrawCommandCreate(Sender, aDrawCommand: TObject);
    var
    lDrawText: TppDrawText;
    lMemoHeight: Double;
    begin

    lDrawText := TppDrawText(aDrawCommand);
    lMemoHeight := ppFromMMThousandths(lDrawText.Height, utInches,
    pprtVertical, nil);

    ppDBText1.Height := lMemoHeight;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.