Recent

Author Topic: LazReport heading  (Read 3285 times)

perhen

  • New Member
  • *
  • Posts: 15
LazReport heading
« on: March 02, 2018, 02:39:09 pm »
Hi

In a LazReport pageheader I want a text from an TEdit component visible on screen. From LazReport tutorial I see

      procedure TForm1.Button1Click(Sender:TObject);
      begin
        frReport1.Values.FindVariable('test').Field := QuotedStr('test1');
        frReport1.ShowReport;
     end;

The .lrf file is loaded, I have created the variable 'test' in category 'myown' in frReport1. 'test' is connected to values [None] in variables editor. Variable 'test' is placed  in band on canvas together with a label.

I expected to see 'test1' printed when clikcing Button1, but only the label are printed.

I have removed the master data band at this stage.

Is there an explanation to the poor result. >:(


taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: LazReport heading
« Reply #1 on: March 02, 2018, 03:26:37 pm »
Start a new application drop an frReport on the form, set its property StoreInForm to true in the object inspector, open the designer and drop a report title band, in that band drop a rectangle object and start its editor, in the memo editor type [Test1], close the editor and the report designer. Drop a button on the form and double click it to autocreate  the click event add the code below.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender :TObject);
  2. begin
  3.   frVariables.Variable['Test1'] := 'This is a test' ;
  4.   frReport1.ShowReport;
  5. end;
  6.  
save and execute your application, press the button. The first time the code is executed the variable will be auto inserted, the consequent clicks will only change its value.
« Last Edit: March 02, 2018, 03:28:43 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

balazsszekely

  • Guest
Re: LazReport heading
« Reply #2 on: March 02, 2018, 03:42:54 pm »
I also attach a small demo example. Hope it helps.

perhen

  • New Member
  • *
  • Posts: 15
[Solved] LazReport heading
« Reply #3 on: March 02, 2018, 07:22:58 pm »
 :D  Thank you very much!!
       My problems are solved. Perfect.

 

TinyPortal © 2005-2018