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

Problem with using procedures/functions in RAP

edited September 2003 in RAP
Hi !

I have a problem with using procedures/functions in RAP.

I want to implement some procedure like this:
procedure AddLinesToList(pList: TStrings);
begin
pList.Add('Line1');
pList.Add('Line2');
end;

And in ReportBeforePrint event use it like:
var
lList: TStrings;
begin
lList := TStringList.Create;

AddLinesToList(lList);

lList.Free;
end;
After calling procedure AddLinesToList(lList) I have empty lList.

When I put inside procedure AddLinesToList the next code:
if pList = nil then
ShowMessage('pList is null '); it show me this message always when
I use this procedure.

I use Delphi 6, RBuilder 6.03.
All procedures/functions I create in RAP , not Delphi code.

Thanks,
Roman

Comments

  • edited September 2003
    Hi Roman,

    I reproduced the problem. Even adding the parameter as a var param it
    doesn't work. RAP must be making a copy of the object behind the scenes and
    adding to that instead of the incoming object. As a workaround, can you
    create and populate the entire list in the global function instead of trying
    to pass a reference to the list in the procedure?


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.