Recent

Author Topic: LazReport, change a caption at runtime in memo / still a problem  (Read 12985 times)

fretty1

  • New Member
  • *
  • Posts: 14
How can I change the text in a retangle (memo1.memo)  at runtime in LazReport?

just before print this text is changed.
like Memo1.memo  := myform.label1.caption  (in lazreport footerband)
I cannot find a way to do this in the system or FreeReport documentation.
« Last Edit: August 22, 2010, 01:20:37 pm by fretty1 »

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: LazReport, change a caption at runtime in memo1
« Reply #1 on: July 06, 2010, 09:51:46 am »
Use the Memo's lines property. ::)
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

fretty1

  • New Member
  • *
  • Posts: 14
Re: LazReport, change a caption at runtime in memo1
« Reply #2 on: July 10, 2010, 03:59:01 pm »
Thanks but...

The lazreport designer uses a file to save the Memo1.memolines

in  Delphi-Quickreport i can simply write:
quickreport1.label1.caption := myform.label1.caption

with Lazreport  ?
????.memo1.memo:=myform.label1.caption

there is no frReport.Memo1  I can use.

what do I write for ????


stonefull

  • Jr. Member
  • **
  • Posts: 54
Re: LazReport, change a caption at runtime in memo1
« Reply #3 on: July 10, 2010, 04:48:49 pm »
In Text object put '[Memo]' (without apostrophes) and type in OnEnterRect event:

if (Memo[0] = '[Memo]') then
       view.Memo.Text := Edit1.Text;   // for example

Zaher

  • Hero Member
  • *****
  • Posts: 679
    • parmaja.org
Re: LazReport, change a caption at runtime in memo1
« Reply #4 on: July 11, 2010, 12:31:02 pm »
You can use variable in your memo like [MYVAR] then change it in OnGetValue
or find memo object by name
aMemo := frReport.FindObject('MyMemo');
aMemo.Memo.Text := 'mycaption';

fretty1

  • New Member
  • *
  • Posts: 14
Re: LazReport, change a caption at runtime in memo1
« Reply #5 on: July 21, 2010, 10:22:30 pm »
Thanks

In the mean time I have been exploring Fortes report (it still has a form-reload bug  (linux))  but it looks promessing.
I will have to make a choice





fretty1

  • New Member
  • *
  • Posts: 14
Re: LazReport, change a caption at runtime in memo1
« Reply #6 on: August 21, 2010, 09:03:49 pm »
I still can not get it right in Lazreport

I have a rectangular with the text string (simplified)  'hello'  

This is my procedure

procedure TForm1.frReport1GetValue(const ParName: String; var ParValue: Variant
  );
begin
   if ParName='hello' then ParValue:='goodbye';
end;  


In both design-view or after compiling I never get the ParValue (goodbye)

I looked at the Lazreport examplefiles and cannot see where I went wrong
I used no functions or variables  (the Lazreport examplefile stringgrid gave an error when I click Design report)

(btw  the databaseconnected part of the report works perfectly)
« Last Edit: August 21, 2010, 09:37:09 pm by fretty1 »

Zaher

  • Hero Member
  • *****
  • Posts: 679
    • parmaja.org
Re: LazReport, change a caption at runtime in memo1
« Reply #7 on: August 21, 2010, 10:36:20 pm »
Try to put hello between brackets like [hello]

fretty1

  • New Member
  • *
  • Posts: 14
Re: LazReport, change a caption at runtime in memo1
« Reply #8 on: August 22, 2010, 11:30:01 am »
Then I get the error:    An error occured during calculation.

looking around I found the variables-list.
The variable was not in the variables list.   shouldn't they be added automaticly??
When I add the variable I do not get this error message but on preview, but  the output of the memo is blanc.
the examplefile (lazreport - stringgrid)  works OK (in runtime) in designtime adding a memo and a new variable crashed Lazarus.

In this examplefile variableslist there is a header (Default ? )    the variables have one pre-space. 
Both suggestions (ongetvalue and onenterrect  I cannot get to work  (memo[0]  an array?)
     
still puzzled.

fretty
« Last Edit: August 22, 2010, 12:57:51 pm by fretty1 »

jesusr

  • Sr. Member
  • ****
  • Posts: 484
Re: LazReport, change a caption at runtime in memo / still a problem
« Reply #9 on: August 23, 2010, 08:28:47 pm »
check that you are using [hello] in memo editor, then your OnGetValue handler should work, if still it doesn't work, check that you are using {$H+} at the top of the unit where the OnGetValue handler reside, there was a bug report where {$H+} was missing and this caused a bad string conversion

Hiba HL

  • New member
  • *
  • Posts: 8
Re: LazReport, change a caption at runtime in memo / still a problem
« Reply #10 on: June 27, 2019, 10:04:04 am »
execuse me
I am using fortes reports .. when I transport the text from a form memo to Rlmemo the text is out of the bounds of the RLMemo
the instruction I used is:
Report.RLmemo.Lines := Form. memo.lines
so the text in the fortes memo is out of the bounds :(
how to solve it?

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: LazReport, change a caption at runtime in memo / still a problem
« Reply #11 on: June 27, 2019, 04:20:51 pm »
How can I change the text in a retangle (memo1.memo)  at runtime in LazReport?

just before print this text is changed.
like Memo1.memo  := myform.label1.caption  (in lazreport footerband)
I cannot find a way to do this in the system or FreeReport documentation.
You first need to clear the memo and then ADD to it.
Look at this piece of code as an example:
Code: Pascal  [Select][+][-]
  1.   for Save_ID := 1 to 14 do begin
  2.     Form_RefereeMain.frReport_Evaluatie.FindObject('Memo' + Save_ID.ToString).Memo.Clear;
  3.     case Save_RL of
  4.       'R' : Form_RefereeMain.frReport_Evaluatie.FindObject('Memo' + Save_ID.ToString).Memo.Add
  5.                  (MLookUP ('EPR_Eng_Tekst', 'tbl_Evaluatie_Referee_Categorie',
  6.                   'EPR_Volgorde = ' + Save_ID.ToString));
  7.       'L' : Form_RefereeMain.frReport_Evaluatie.FindObject('Memo' + Save_ID.ToString).Memo.Add
  8.                  (MLookUP ('EPL_Eng_Tekst', 'tbl_Evaluatie_Linesman_Categorie',
  9.                   'EPL_Volgorde = ' + Save_ID.ToString));
  10.     end;  // case
  11.   end;  // for
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

 

TinyPortal © 2005-2018