Home RAP

Copy Memo1 contents to Memo2

edited September 2009 in RAP
Hi all,
D2007 & RB11.04 Enterprise

Invoice has multiple bands. In the Main, there are 2 Memos, 1 for Customer
Name/Address/..., 2nd for BillTo if exists other than Customer. The Invoice
may have a tear-off remittance stub which includes another memo which we
copy the Customer info to using our Delphi app. as follows:

procedure TppFrmInvoice.ppMemoRemittanceCustNamePrint(Sender: TObject);
var
FName: String;
begin
try
ppMemoRemittanceCustName.Lines.Clear;
FName := ppCustNameMemo.GetText;
ppMemoRemittanceCustName.Lines.Add(FName);
except
on E: Exception do
begin
ShowMessage(E.Message);
end;
end;
end;


A client wishes to have the BillTo info as well. Trying to use RAP to do
this using the following, but RAP isn't happy:

procedure MemoRemittanceBillToOnPrint;
var
FName: String;
begin
MemoRemittanceBillTo.Lines.Clear;
FName := Main.CustNameMemo.GetText;
MemoRemittanceBillTo.Lines.Add(FName);
end;

Questions: Does RAP know GetText? How do I correctly point to an object in
a different band?

Thanks,
Mark

Comments

  • edited September 2009

    Memo.Lines is of type TStrings.

    So the simplest syntax is

    myMemo2.Lines.Text := myMemo1.Lines.Text;

    The above will work for Delphi code and RAP code.

    Within a report or childreport you can reference an object by it's UserName
    property.

    If you want to reference the main report's Memo from a childreport, then
    declare a global RAP variable

    gMemo: TppMemo

    And initialize it in the global OnCreate event

    gMemo := Memo1;

    Then you can use in the childreport

    myMemo2.Lines.Text := gMemo.Lines.Text;



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2009
    Thanks Nard

This discussion has been closed.