How to find a component by its classname in a report
We derived TppDBCalcA as a sublass of TppDBCalc.
As we want to deprecate this component know, we would like
do disallow the user to insert it into reports.
For existing reports using this component, it still should be possible
to insert.
I now want to detect, where a report has a component of this classname
"TppDbCalcA". Is there a method or do i have to loop through all
elements within the report?
Tia Carsten
--
Hint: We altered the sources!Hint: We altered the sources!
As we want to deprecate this component know, we would like
do disallow the user to insert it into reports.
For existing reports using this component, it still should be possible
to insert.
I now want to detect, where a report has a component of this classname
"TppDbCalcA". Is there a method or do i have to loop through all
elements within the report?
Tia Carsten
--
Hint: We altered the sources!Hint: We altered the sources!
This discussion has been closed.
Comments
There is no built-in function. A simple way to do this is to use the
Form/DataModule that 'owns' the report, bands, components and iterate over
the Components[ ] array.
For liIndex := 0 to myReportForm.ComponentCount-1 do
if myReportForm.Components[liIndex] is TppDbCalcA then
// do something here
You could use the above to implement function such as
function ContainsClassType(aOwner: TComponent, aClassType: TClass); Boolean;
Best regards,
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
your solution sounds good, but i can find the component.
my idea is to call a routine at the end of TppDesigner.SetReport.
So I have aReport AS TppReport or self as TppDesigner.
Unfortunately i could not find my component in any Components[].
I am bit bit puzzled...
Tia Carsten
Nard Moseley (Digital Metaphors) schrieb am 07.04.2016 :
--
Hint: We altered the sources!Hint: We altered the sources!
http://www.digital-metaphors.com:8080/Delphi_Code/Layouts/Report_Object_Loop
Yes Report.Bands[ ].Objects[ ] is another valid approach.
Best regards,
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com