Recent

Author Topic: How to create a memo and assign to a band at runtime?  (Read 2158 times)

GaborBoros

  • New Member
  • *
  • Posts: 21
How to create a memo and assign to a band at runtime?
« on: September 15, 2017, 10:29:56 pm »
Hi All,

I want to add  an Overlay to an existing complex report at runtime. The below code works but don't know how to specific explicitly the owner band of the memo.

Code: Pascal  [Select]
  1. var
  2.   b:TfrBandView;
  3.   m:TfrMemoView;
  4.  
  5. begin
  6.   b:=TfrBandView.Create(MyReport.Pages[0]);
  7.   b.CreateUniqueName;
  8.   b.BandType:=btOverlay;
  9.   b.SetBounds(0,30,0,50);
  10.  
  11.   m:=TfrMemoView.Create(MyReport.Pages[0]);
  12.   m.CreateUniqueName;
  13.   m.SetBounds(30,40,50,20);
  14.   m.Memo.Text:='Memo1';

Gabor

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: How to create a memo and assign to a band at runtime?
« Reply #1 on: September 15, 2017, 10:37:07 pm »
Bands do not own objects or parent them they choose the controls that are placed on top of them at design time. So make sure the setbounds call places it on top of the band you want.
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