read the sections in the user manual on bulding reports from code starting on page 23 once you understand how to add bands and objects to the band use the correct band type tfrxoverlay
read the sections in the user manual on bulding reports from code starting on page 23 once you understand how to add bands and objects to the band use the correct band type tfrxoverlay
read the sections in the user manual on bulding reports from code starting on page 23 once you understand how to add bands and objects to the band use the correct band type tfrxoverlay
Hi Gord,
I tried to add an overlay band to a report but it doesent works.
May u kindly write a small sample for me? I need to print that band for a nag
message in each page.
read the sections in the user manual on bulding reports from code starting on page 23 once you understand how to add bands and objects to the band use the correct band type? tfrxoverlay
This is my func, but it doesent works. It comes from an old working func from FR2.57. Wher's mistakes?
procedure TStmpTab.NagScreen(lSet: boolean);
var Page: tFRxPage; v: tFRxMemoView; b: tFRxOverlay; pgIndex: integer;
begin
for PgIndex := 0 to StTab.PagesCount - 1 do
begin
Page := StTab.Pages[pgIndex];
if Page.Report.GetDescription = 'Report' then
begin
if lSet then
begin
//Aggiungo la Banda Overlay
b := TfrxOverlay.Create(Self);
b.CreateUniqueName;
b.SetBounds(0, 9.30,20,2.60);
b.Visible := True;
Page.Objects.Add( b );
//Aggiungo il campo memo
v := TfrxMemoView.Create(self);
v.CreateUniqueName;
Here is a sample, judging from your last reply sample
stop trying to write fr2.5 code for fr3.
procedure TForm1.Button1Click(Sender: TObject);
var
Page: TfrxReportPage;
Band: TfrxBand;
DataBand: TfrxMasterData;
Memo: TfrxMemoView;
begin
{ clear a report }
frxReport1.Clear;
{add a dataset/s to the list of ones accessible for a report }
{FOR I:= 0 TO FRXDBDATASET1.FieldsCount -1 DO
BEGIN
FRXDBDATASET1.FI
WITH FRXDBDATASET1.F
BEGIN
Add('FLD'+INTTOSTR(I));
END;
END;}
frxReport1.DataSets.Add(frxDBDataSet1);
// add any variables to dictionaru
// add a category to the variables list
//frxReport1.Variables := Null;
// add a variable to category
//frxReport1.Variables := 10;
frxreport1.Variables.LoadFromFile(wpath+'1.fd3');
{ add a page }
Page := TfrxReportPage.Create(frxReport1);
{ create a unique name }
Page.CreateUniqueName;
{ set sizes of fields, paper and orientation by default }
{ if you use call below you will pickup values for current default printer.
along with default margin settings, if not you will get a page of a4 size and 0 for all margins}
{ add a report overlay band}
Band := TfrxOverlay.Create(Page);
Band.CreateUniqueName;
{ it is sufficient to set the ?«Top?» coordinate and height for a band }
{ both coordinates are in pixels }
Band.Top := (page.Topmargin + 5); {added to make sure bands name tab is visible if viewing in design mode.}
Band.Height := 21;
{ add an object to the report overlay band }
Memo := TfrxMemoView.Create(Band);
Memo.CreateUniqueName;
Memo.Text := 'Demo';
Memo.Height := 20;
{ this object will be stretched according to band's width }
Memo.Align := baWidth;
Memo.HAlign := haRight;
{ add the masterdata band }
DataBand := TfrxMasterData.Create(Page);
DataBand.CreateUniqueName;
DataBand.DataSet := frxDBDataSet1;
{ the Top coordinate should be greater than the previously added band's top + height}
DataBand.Top := 100;
DataBand.Height := 20;
{ add an object on master data }
Memo := TfrxMemoView.Create(DataBand);
Memo.CreateUniqueName;
{ connect to data }
//Memo.DataSet := frxDBDataSet1;
//Memo.DataField := 'CustNo';
Memo.SetBounds(0, 0, 100, 20);
memo.Memo.Add('[frxDBDataset1."CustNo"]'); // or add data this way
{ adjust the text to the object's right margin }
Memo.HAlign := haRight;
if cb1.Checked = true then
frxreport1.DesignReport
else
frxreport1.ShowReport(true);
end;
yes, it's true! I'm trying to export a project from 2.5 to 3.x since a couple of days and it' s not easy understand a new programming way in a short time.
Btw, FR 3.x seems to be a very great job, many congratulations !!
I' ve to convert more than 25 reports... I'll pass XMas holidays in fron to my pc!
Here is a sample, judging from your last reply sample
stop trying to write fr2.5 code for fr3.
procedure TForm1.Button1Click(Sender: TObject);
var
Page: TfrxReportPage;
Band: TfrxBand;
DataBand: TfrxMasterData;
Memo: TfrxMemoView;
begin
{ clear a report }
frxReport1.Clear;
{add a dataset/s to the list of ones accessible for a report }
{FOR I:= 0 TO FRXDBDATASET1.FieldsCount -1 DO
BEGIN
FRXDBDATASET1.FI
WITH FRXDBDATASET1.F
BEGIN
Add('FLD'+INTTOSTR(I));
END;
END;}
frxReport1.DataSets.Add(frxDBDataSet1);
// add any variables to dictionaru
// add a category to the variables list
//frxReport1.Variables := Null;
// add a variable to category
//frxReport1.Variables := 10;
frxreport1.Variables.LoadFromFile(wpath+'1.fd3');
{ add a page }
Page := TfrxReportPage.Create(frxReport1);
{ create a unique name }
Page.CreateUniqueName;
{ set sizes of fields, paper and orientation by default }
{ if you use call below you will pickup values for current default printer.
along with default margin settings, if not you will get a page of a4 size and 0 for all margins}
{ add a report overlay band}
Band := TfrxOverlay.Create(Page);
Band.CreateUniqueName;
{ it is sufficient to set the ?«Top?» coordinate and height for a band }
{ both coordinates are in pixels }
Band.Top := (page.Topmargin + 5); {added to make sure bands name tab is visible if viewing in design mode.}
Band.Height := 21;
{ add an object to the report overlay band }
Memo := TfrxMemoView.Create(Band);
Memo.CreateUniqueName;
Memo.Text := 'Demo';
Memo.Height := 20;
{ this object will be stretched according to band's width }
Memo.Align := baWidth;
Memo.HAlign := haRight;
{ add the masterdata band }
DataBand := TfrxMasterData.Create(Page);
DataBand.CreateUniqueName;
DataBand.DataSet := frxDBDataSet1;
{ the Top coordinate should be greater than the previously added band's top + height}
DataBand.Top := 100;
DataBand.Height := 20;
{ add an object on master data }
Memo := TfrxMemoView.Create(DataBand);
Memo.CreateUniqueName;
{ connect to data }
//Memo.DataSet := frxDBDataSet1;
//Memo.DataField := 'CustNo';
Memo.SetBounds(0, 0, 100, 20);
memo.Memo.Add('[frxDBDataset1."CustNo"]'); // or add data this way
{ adjust the text to the object's right margin }
Memo.HAlign := haRight;
if cb1.Checked = true then
frxreport1.DesignReport
else
frxreport1.ShowReport(true);
end;
Hi gord, Other 2 questions:
I don't need to build a new page in order to display a nag report, but I' ve to put in a middle of every page printed the string "demo".
So i changed something from your code and it works, t it seems impossible to put it in the middle of the page. I tried both to modify values of
band.top and band.height or setting band.SetBound() but no way, it's printed on top of first page.
An other problem to solve is to obtain the nag string over any memo field in order
to "cover" data.
Comments
I tried to add an overlay band to a report but it doesent works.
May u kindly write a small sample for me? I need to print that band for a nag
message in each page.
thanx
TGD
procedure TStmpTab.NagScreen(lSet: boolean);
var Page: tFRxPage; v: tFRxMemoView; b: tFRxOverlay; pgIndex: integer;
begin
for PgIndex := 0 to StTab.PagesCount - 1 do
begin
Page := StTab.Pages[pgIndex];
if Page.Report.GetDescription = 'Report' then
begin
if lSet then
begin
//Aggiungo la Banda Overlay
b := TfrxOverlay.Create(Self);
b.CreateUniqueName;
b.SetBounds(0, 9.30,20,2.60);
b.Visible := True;
Page.Objects.Add( b );
//Aggiungo il campo memo
v := TfrxMemoView.Create(self);
v.CreateUniqueName;
v.SetBounds(0.10,0.20,19.70,2.00);
v.Align := baCenter;
v.Font.Name := 'Courier New';
v.Font.Size := 48;
v.Font.Style := [fsBold];
v.Visible := True;
v.Memo.Text := 'Unregistered';
Page.Objects.Add(v);
end;
end;
end;
end;
Thanx for help
TGD
stop trying to write fr2.5 code for fr3.
procedure TForm1.Button1Click(Sender: TObject);
var
Page: TfrxReportPage;
Band: TfrxBand;
DataBand: TfrxMasterData;
Memo: TfrxMemoView;
begin
{ clear a report }
frxReport1.Clear;
{add a dataset/s to the list of ones accessible for a report }
{FOR I:= 0 TO FRXDBDATASET1.FieldsCount -1 DO
BEGIN
FRXDBDATASET1.FI
WITH FRXDBDATASET1.F
BEGIN
Add('FLD'+INTTOSTR(I));
END;
END;}
frxReport1.DataSets.Add(frxDBDataSet1);
// add any variables to dictionaru
// add a category to the variables list
//frxReport1.Variables := Null;
// add a variable to category
//frxReport1.Variables := 10;
frxreport1.Variables.LoadFromFile(wpath+'1.fd3');
{ add a page }
Page := TfrxReportPage.Create(frxReport1);
{ create a unique name }
Page.CreateUniqueName;
{ set sizes of fields, paper and orientation by default }
{ if you use call below you will pickup values for current default printer.
along with default margin settings, if not you will get a page of a4 size and 0 for all margins}
Page.SetDefaults;
{ modify paper's orientation interface uses clause needs printers}
//Page.Orientation := poLandscape;
{ add a report overlay band}
Band := TfrxOverlay.Create(Page);
Band.CreateUniqueName;
{ it is sufficient to set the ?«Top?» coordinate and height for a band }
{ both coordinates are in pixels }
Band.Top := (page.Topmargin + 5); {added to make sure bands name tab is visible if viewing in design mode.}
Band.Height := 21;
{ add an object to the report overlay band }
Memo := TfrxMemoView.Create(Band);
Memo.CreateUniqueName;
Memo.Text := 'Demo';
Memo.Height := 20;
{ this object will be stretched according to band's width }
Memo.Align := baWidth;
Memo.HAlign := haRight;
{ add the masterdata band }
DataBand := TfrxMasterData.Create(Page);
DataBand.CreateUniqueName;
DataBand.DataSet := frxDBDataSet1;
{ the Top coordinate should be greater than the previously added band's top + height}
DataBand.Top := 100;
DataBand.Height := 20;
{ add an object on master data }
Memo := TfrxMemoView.Create(DataBand);
Memo.CreateUniqueName;
{ connect to data }
//Memo.DataSet := frxDBDataSet1;
//Memo.DataField := 'CustNo';
Memo.SetBounds(0, 0, 100, 20);
memo.Memo.Add('[frxDBDataset1."CustNo"]'); // or add data this way
{ adjust the text to the object's right margin }
Memo.HAlign := haRight;
if cb1.Checked = true then
frxreport1.DesignReport
else
frxreport1.ShowReport(true);
end;
yes, it's true! I'm trying to export a project from 2.5 to 3.x since a couple of days and it' s not easy understand a new programming way in a short time.
Btw, FR 3.x seems to be a very great job, many congratulations !!
I' ve to convert more than 25 reports... I'll pass XMas holidays in fron to my pc!
TGD
I don't need to build a new page in order to display a nag report, but I' ve to put in a middle of every page printed the string "demo".
So i changed something from your code and it works, t it seems impossible to put it in the middle of the page. I tried both to modify values of
band.top and band.height or setting band.SetBound() but no way, it's printed on top of first page.
An other problem to solve is to obtain the nag string over any memo field in order
to "cover" data.
How to do that?