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

TppCustomText.Displayformat

edited December 2006 in General
Hi,

I'm trying to get the DisplayFormat property of a TppCustomText using the
following code:

TppCustomText(self.components[i]).displayformat := s;

However, Delphi raises a compile error saying that displayformat is an
undeclared identifier. (Yet the help file says that displayformat should be
a property of TppCustomText).

Am I doing something wrong?

Thanks & Regards

Adam.

Comments

  • edited December 2006
    I ran into the same problem a while ago, if you'd look in the source you'll
    see the property is protected and therefore cannot be accessed. I think the
    help is just wrong here...

  • edited December 2006
    Hi Adam,

    The TppCustomText.DisplayFormat property is protected. Try using the
    descendent class of the TppCustomText.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hi Mark,

    I checked both of our help systems and verified that there is a "protected"
    symbol next to the DisplayFormat property in the TppCustomText topic.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hi Mark and Nico,

    Thanks for your replies.


    Is there a reason for this to be protected? (ie, will it cause problems if I
    modify the source, and change this)?

    The reason I ask, is that I want to be able to modify the display property
    on multiple types within the same line of code, and the closest parent they
    have in the heirachy is the TppCustomText.

    If not - may I put through a request that it be unprotected too in the next
    minor release?

    Thanks & Regards

    Adam.
  • edited December 2006

    - do not change the Interface section of any of the ReportBuilder units.

    - there is a note in the RB source code that explains DisplayFormat is
    declared protected because TppLabel does not support it.

    - I recommend using Run Time Type Information, (RTTI). You can either use
    Delphi's built-in functions (declared in TypInfo.pas) or you can use RB's
    easier to use methods which in turn call Delphi's (see ppRTTI.pas).

    example:

    uses
    ppRTTI:

    if (TraRTTI.IsValidPropName(myObject, 'DisplayFormat') then
    TraRTTI.SetPropValue(myObject, 'DisplayFormat', lsDisplayFormat);



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2006
    Hi Nard,

    Thanks for your reply. I didn't know (or have completely forgot) about the
    RTTI's. Thanks heaps!

    Cheers

    Adam.
This discussion has been closed.