Home RAP

Asking for TLabel Width property dinamically

edited July 2014 in RAP
I have two labels (label1 and label2). Label2 must change its left
position depending on the width of label1 to keep it near each other
I need to know the widht of Label1 which has the autosize property set
to (True), in order to change the left position of Label2 in every
printed detail.
When I ask for label1.widht on the OnPrint event of Label2, it always
shows the same widht value.
Is that posible to know the exact widht of Label1 dinámically?

I'm using RB 14.08



  • edited July 2014
    Hi Ignacio,

    An autosized component width is never actually changed, the drawcommand
    width is altered when the component is rendered.

    One option would be to measure the text yourself using a Bitmap or
    Printer Canvas then offsetting the second label based on that measurement.

    Another would be to use a single label or memo and manually construct
    the two side-by-side text values.

    Label1.Caption := MyText1 + ' ' + MyText2;

    Moving forward, we hope you will consider upgrading to the latest
    version of ReportBuilder. See the following web site for the new
    features added for RB 15.


    Best Regards,

    Nico Cizik
    Digital Metaphors
This discussion has been closed.