TppCustomText.Displayformat
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.
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.
This discussion has been closed.
Comments
see the property is protected and therefore cannot be accessed. I think the
help is just wrong here...
The TppCustomText.DisplayFormat property is protected. Try using the
descendent class of the TppCustomText.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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.
- 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
Thanks for your reply. I didn't know (or have completely forgot) about the
RTTI's. Thanks heaps!
Cheers
Adam.