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