Lazarus

Programming => Packages and Libraries => LazReport => Topic started by: Ever on October 27, 2018, 12:38:54 am

Title: [SOLVED] Find object in report
Post by: Ever on October 27, 2018, 12:38:54 am
Regards
    There is some way to know if a memo object is created within a report format. Example: Within the report order.lrf there is the memo object with the name address, I want to know if this object is created in the report at run time and if it is not created and assigned a value.
    Thank you
Title: Re: Find object in report
Post by: korba812 on October 27, 2018, 12:16:28 pm
You should use TfrPage.FindObject method
eg.:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   MyMemo: TfrObject;
  4. begin
  5.   MyMemo := frReport1.Pages[0].FindObject('address');
  6.   if MyMemo = nil then
  7.   begin
  8.     MyMemo := TfrMemoView.Create(frReport1.Pages[0]);
  9.     MyMemo.Name := 'address';
  10.     MyMemo.Top := 100;
  11.     MyMemo.Left := 100;
  12.     MyMemo.Width := 100;
  13.     MyMemo.Height := 100;
  14.     MyMemo.Memo.Text := 'Some text';
  15.   end
  16.   else
  17.     if Trim(MyMemo.Memo.Text) <> 'Some text' then
  18.       MyMemo.Memo.Text := 'Some text';
  19. end;
  20.  
Title: Re: Find object in report
Post by: Ever on October 27, 2018, 04:18:15 pm
Thanks, that's precisely what I needed
TinyPortal © 2005-2018