Recent

Author Topic: [SOLVED] Find object in report  (Read 4415 times)

Ever

  • Jr. Member
  • **
  • Posts: 61
[SOLVED] Find object in report
« 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
« Last Edit: October 27, 2018, 04:18:38 pm by Ever »

korba812

  • Sr. Member
  • ****
  • Posts: 391
Re: Find object in report
« Reply #1 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.  

Ever

  • Jr. Member
  • **
  • Posts: 61
Re: Find object in report
« Reply #2 on: October 27, 2018, 04:18:15 pm »
Thanks, that's precisely what I needed

 

TinyPortal © 2005-2018