Creating a dialogue form from a code
As we know, a report can contain dialogue forms. The following example shows how to create a dialogue form, with an «OK» button:
Pascal:
{ for working with dialogue objects the following unit should be used }
uses frxDCtrl;
var
Page: TfrxDialogPage;
Button: TfrxButtonControl;
{ add a page }
Page := TfrxDialogPage.Create(frxReport1);
{ create a unique name }
Page.CreateUniqueName;
{ set sizes }
Page.Width := 200;
Page.Height := 200;
{ set a position }
Page.Position := poScreenCenter;
{ add a button }
Button := TfrxButtonControl.Create(Page);
Button.CreateUniqueName;
Button.Caption := 'OK';
Button.ModalResult := mrOk;
Button.SetBounds(60, 140, 75, 25);
{ show a report }
frxReport1.ShowReport;
C++:
// for working with dialogue objects the following unit should be used
#include "frxDCtrl.hpp"
TfrxDialogPage * Page;
TfrxButtonControl * Button;
// add a page
Page = new TfrxDialogPage(frxReport1);
// create a unique name
Page->CreateUniqueName();
// set sizes
Page->Width = 200;
Page->Height = 200;
// set a position
Page->Position = poScreenCenter;
// add a button
Button = new TfrxButtonControl(Page);
Button->CreateUniqueName();
Button->Caption = "OK";
Button->ModalResult = mrOk;
Button->SetBounds(60, 140, 75, 25);
// show a report
frxReport1->ShowReport(true);