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

How do I use OnGetMemo?

edited March 2003 in General
procedure TForm1.mem1GetMemo(Sender: TObject; aLines: TStrings);
begin
memGL_Text.Lines.Assign(aLines);
end;

Gives me a Stack Overflow.

I want to add a blank line (or sometimes a piece of text) to the
bottom of memo lines comming from disk. Like so...

procedure TForm1.mem1GetMemo(Sender: TObject; aLines: TStrings);
begin
aLines.Add('THIS IS MY REPORT');
memGL_Text.Lines.Assign(aLines);
end;

No go.

Comments

  • edited March 2003
    CODE CORRECTION:

    procedure TForm1.mem1GetMemo(Sender: TObject; aLines: TStrings);
    begin
    mem1.Lines.Assign(aLines);
    end;

    Gives me a Stack Overflow.

    I want to add a blank line (or sometimes a piece of text) to the
    bottom of memo lines comming from disk. Like so...

    procedure TForm1.mem1GetMemo(Sender: TObject; aLines: TStrings);
    begin
    aLines.Add('THIS IS MY REPORT');
    mem1.Lines.Assign(aLines);
    end;

    No go.
  • edited March 2003
    I still need help with this....

    Nard? Somebody?
  • edited March 2003
    The aLines parameter object is the Memo.Lines object, ie. you should never
    call Self.Assign(Self). Either call methods on the aLines parameter or on
    the Memo.Lines object.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited March 2003
    K-Man,

    Please use your real name for your news account when you post to the Digital
    Metaphors newsgroups- Thankyou.

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited March 2003
    > Real name entered.

    I started by doing this:

    aLines.Add('THIS IS MY TEXT');

    However, from the RB help, if there is an OnGetMemo assigned, then the
    DBmemo component doesn't automatically get the lines assigned to it,
    and sure enough, my memos come out blank. I can add my line of text,
    but how do I tell the DBmemo that I now want the aLines to be printed?

    OnGetText for the dbText component was easy to understand. This seems
    more difficult. I need a small example.

    Kev.
  • edited March 2003
    You'll have to pull the memo data drom the data pipeline. The aLines
    parameter is empty coming into this event because the data hasn't been
    pulled from the pipeline. Assigning the memo data is you responsibility when
    this event is assigned.

    procedure TForm1.ppDBMemo1GetMemo(Sender: TObject; aLines: TStrings);
    begin

    if True then
    aLines.Text := 'Hello there.'
    else
    aLines.Text := ppReport1.DataPipeline['Notes'] {From DBDemos Biolife
    table}

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.