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

Determine textwidth in mm

edited October 2009 in Datapipelines
Hi

im trying to determine the maxwidth of a control by using TCanvas.textWidth('WWWWWWWWWWW')
and this yields a result fo 1056
But i'm unsure how to convert this to the mm unit that is used when setting
component bounds with mmSetBounds().

Can anyone point me in the right direction?

Comments

  • edited October 2009
    posted in wrong group

    sorry
  • edited October 2009
    Hi Bas,

    There are numerous utility routines that you can use to convert units
    located in the ppUtils.pas file. Specifically ppToMMThousandths.

    What exactly are you trying to accomplish? Simply setting the Top, Left,
    Width, and Height properties of a component using the proper report units
    will automatically convert the value to thousandths of milimeters. There
    should be no need to use the mmSetBounds routine.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2009
    Hello Nico,

    I'm trying to set the width of a DBText control to the textwidth of a number
    of 'W' characters
    But somehow in the conversion of units something goes wrong.
  • edited October 2009
    Hi Bas,

    The units you are converting from depends on the device context of the
    canvas you are using to make the initital measurement. If for instance you
    are using the Canvas property of a TBitmap, your initial units will be
    screen pixels. Once you know your initial units, it should be fairly easy
    to make a conversion to a different unit using the helper functions in
    ppUtils.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2009

    As Nico stated, the DBText.Width reflects the Report.Units

    An alternative is to use DBText.spWidth which is in screen pixels.

    And there is also DBText.mmWidth which is in mmThousandths



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.