Transfer procedure not implemented for TppGroup?
Hi,
I'm modifying a report template runtime to add several more groups. These
groups are created as a copy from an already present "Mastergroup", with
only the breakname field changed.
At first i tried to use the standard delphi TComponent methods Assign() or
AssignTo() but these are not overridden for the TppGroup component.
Then i spotted a virtual method Transfer() in the TppReport definition that
seems to implement some sort of Assign. I tried using that for TppGroup but
this method is also no implemented for the TppGroup so only the TppRelative
version of Transfer is used, which doesn't do a lot of good when trying to
create a copy of a group-component.
Now i've implemented the whole thing by streaming the original group to a
memorystream, creating a new TppGoup with ppClasUt.ppComponentCreate and
then reading all component settings from the created stream
--------------------------------
MaingroupName := MainGroup.Name;
MainGroup.Name := ''; //Avoid Name already exists
errors
GrpStream.WriteComponent(MainGroup);
MainGroup.Name := MaingroupName;
GrpStream.Seek(0, soFromBeginning);
Subgroup := TppGroup(ppComponentCreate(FCurrentReport, TppGroup));
GrpStream.ReadComponent(Subgroup);
--------------------------------
My questions:
Are there any standard RB ways of creating a copy of an existing TppGroup
object I havent seen yet?
Are there any plans of implementing the standard delphi Assign, or implementing
the ReportBuilders Transfer method into more components?
greetings
Bas Schouten
I'm modifying a report template runtime to add several more groups. These
groups are created as a copy from an already present "Mastergroup", with
only the breakname field changed.
At first i tried to use the standard delphi TComponent methods Assign() or
AssignTo() but these are not overridden for the TppGroup component.
Then i spotted a virtual method Transfer() in the TppReport definition that
seems to implement some sort of Assign. I tried using that for TppGroup but
this method is also no implemented for the TppGroup so only the TppRelative
version of Transfer is used, which doesn't do a lot of good when trying to
create a copy of a group-component.
Now i've implemented the whole thing by streaming the original group to a
memorystream, creating a new TppGoup with ppClasUt.ppComponentCreate and
then reading all component settings from the created stream
--------------------------------
MaingroupName := MainGroup.Name;
MainGroup.Name := ''; //Avoid Name already exists
errors
GrpStream.WriteComponent(MainGroup);
MainGroup.Name := MaingroupName;
GrpStream.Seek(0, soFromBeginning);
Subgroup := TppGroup(ppComponentCreate(FCurrentReport, TppGroup));
GrpStream.ReadComponent(Subgroup);
--------------------------------
My questions:
Are there any standard RB ways of creating a copy of an existing TppGroup
object I havent seen yet?
Are there any plans of implementing the standard delphi Assign, or implementing
the ReportBuilders Transfer method into more components?
greetings
Bas Schouten
This discussion has been closed.
Comments
Your technique of using component streaming is a great solution.
Currently the Report.Bands[ ].Objects[ ] and Report.Groups[ ] do not have
Assign implemented. Groups have a GroupHeaderBand and GroupFooterBand and
then the Bands have Objects[ ].
Transfer is used internally by the ReportBuilder streaming system. I do not
recommend using it. myReport.Tranfer(myOtherReport) removes all bands,
groups and objects from "myOtherReport" and adds them to myReport. Thus
myOtherReport no longer has any bands, groups or objects.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com