ShiftRelativeTo in code
Hi,
if i add a region in code to an existing report (loaded trough template)
and i alter the UserName of the region and then use this region of
ShiftRelative a ppMemo to this region, it does not work...
if i change the region.Name according to the Username it does work...
so
aRegion := TppRegion.create(nil);
aRegion.Band := ppTemp.SummaryBand;
aRegion.UserName := 'MyRegion';
aExistingMemo.ShiftRelativeTo := aRegion;
does not show in the designer that the memo is going to be shifted..
if i add
aRegion.Name := 'MyRegion';
all works well...
why?
tia,
marc
if i add a region in code to an existing report (loaded trough template)
and i alter the UserName of the region and then use this region of
ShiftRelative a ppMemo to this region, it does not work...
if i change the region.Name according to the Username it does work...
so
aRegion := TppRegion.create(nil);
aRegion.Band := ppTemp.SummaryBand;
aRegion.UserName := 'MyRegion';
aExistingMemo.ShiftRelativeTo := aRegion;
does not show in the designer that the memo is going to be shifted..
if i add
aRegion.Name := 'MyRegion';
all works well...
why?
tia,
marc
This discussion has been closed.
Comments
The UserName is an additional concept we added to enable the end-user to
change the display name at run-time. The Delphi help recommends not
modifying the Name property at runt-time.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
property
if you do the same with a tppmemo, this memo gets a dummy name...
additionally, UserName is the only way to be able to change a customized
design in relation to a default one
very handy to search for the default component
and to set some properties in runtime, if the UserName is correct you always
can find the component
so for me it is far more handy and important than just have a nice display
name!
cu
marc
note that when creating components, the Owner should be the Report.Owner,
which is typically the form/datamodule upon which the report component
resides.
var
lMemo: TppMemo;
begin
lMemo := TppMemo.Create(ppReport1.Owner);
lMemo.Band := ppReport1.DetailBand;
lMemo.UserName := 'TestMemo';
ShowMessage(lmemo.Name);
There is a routine in ppUtils.pas, called ppGetUniqueName, you could try
using that to generate a unique name.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com