mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 00:59:21 +02:00
* Support for Master-Detail relations in data designer
git-svn-id: trunk@57560 -
This commit is contained in:
parent
cc6780a8d2
commit
92e3aa746b
@ -1,11 +1,11 @@
|
|||||||
object ReportDataConfigForm: TReportDataConfigForm
|
object ReportDataConfigForm: TReportDataConfigForm
|
||||||
Left = 500
|
Left = 500
|
||||||
Height = 498
|
Height = 575
|
||||||
Top = 282
|
Top = 282
|
||||||
Width = 612
|
Width = 639
|
||||||
Caption = 'Report Data'
|
Caption = 'Report Data'
|
||||||
ClientHeight = 498
|
ClientHeight = 575
|
||||||
ClientWidth = 612
|
ClientWidth = 639
|
||||||
OnCloseQuery = FormCloseQuery
|
OnCloseQuery = FormCloseQuery
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
@ -14,8 +14,8 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
object BPVariables: TButtonPanel
|
object BPVariables: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 42
|
Height = 42
|
||||||
Top = 450
|
Top = 527
|
||||||
Width = 600
|
Width = 627
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
HelpButton.Name = 'HelpButton'
|
HelpButton.Name = 'HelpButton'
|
||||||
@ -39,7 +39,7 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
Left = 299
|
Left = 299
|
||||||
Height = 27
|
Height = 27
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 304
|
Width = 334
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
@ -55,7 +55,7 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
Left = 299
|
Left = 299
|
||||||
Height = 31
|
Height = 31
|
||||||
Top = 64
|
Top = 64
|
||||||
Width = 307
|
Width = 334
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
OnChange = CBTypeChange
|
OnChange = CBTypeChange
|
||||||
@ -64,13 +64,13 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
end
|
end
|
||||||
object PSources: TPanel
|
object PSources: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 444
|
Height = 521
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 226
|
Width = 226
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
Caption = 'PLeft'
|
Caption = 'PLeft'
|
||||||
ClientHeight = 444
|
ClientHeight = 521
|
||||||
ClientWidth = 226
|
ClientWidth = 226
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
object LLBReportData: TLabel
|
object LLBReportData: TLabel
|
||||||
@ -108,13 +108,12 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
end
|
end
|
||||||
object LBReportData: TListBox
|
object LBReportData: TListBox
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 401
|
Height = 478
|
||||||
Top = 40
|
Top = 40
|
||||||
Width = 192
|
Width = 192
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
OnSelectionChange = LBReportDataSelectionChange
|
OnSelectionChange = LBReportDataSelectionChange
|
||||||
Options = [lboDrawFocusRect]
|
|
||||||
ScrollWidth = 190
|
ScrollWidth = 190
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
TopIndex = -1
|
TopIndex = -1
|
||||||
@ -134,22 +133,22 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
end
|
end
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 226
|
Left = 226
|
||||||
Height = 444
|
Height = 521
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
Width = 5
|
||||||
end
|
end
|
||||||
object PData: TPanel
|
object PData: TPanel
|
||||||
Left = 256
|
Left = 256
|
||||||
Height = 323
|
Height = 365
|
||||||
Top = 117
|
Top = 152
|
||||||
Width = 345
|
Width = 372
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BevelOuter = bvLowered
|
BevelOuter = bvLowered
|
||||||
Caption = 'Create or select a data source'
|
Caption = 'Create or select a data source'
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
object SBPreview: TSpeedButton
|
object SBPreview: TSpeedButton
|
||||||
Left = 578
|
Left = 605
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 23
|
Width = 23
|
||||||
@ -159,6 +158,25 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
ShowHint = True
|
ShowHint = True
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
end
|
end
|
||||||
|
object CBMaster: TComboBox
|
||||||
|
Left = 299
|
||||||
|
Height = 31
|
||||||
|
Top = 104
|
||||||
|
Width = 334
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
ItemHeight = 0
|
||||||
|
OnChange = CBMasterChange
|
||||||
|
Style = csDropDownList
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
|
object Label4: TLabel
|
||||||
|
Left = 248
|
||||||
|
Height = 17
|
||||||
|
Top = 112
|
||||||
|
Width = 40
|
||||||
|
Caption = 'Master'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
object ILReportdata: TImageList
|
object ILReportdata: TImageList
|
||||||
left = 272
|
left = 272
|
||||||
top = 24
|
top = 24
|
||||||
@ -296,8 +314,8 @@ object ReportDataConfigForm: TReportDataConfigForm
|
|||||||
end
|
end
|
||||||
object ALReportData: TActionList
|
object ALReportData: TActionList
|
||||||
Images = ILReportdata
|
Images = ILReportdata
|
||||||
left = 244
|
left = 224
|
||||||
top = 100
|
top = 160
|
||||||
object AAddData: TAction
|
object AAddData: TAction
|
||||||
Category = 'Data'
|
Category = 'Data'
|
||||||
Caption = 'Add'
|
Caption = 'Add'
|
||||||
|
@ -35,8 +35,10 @@ type
|
|||||||
ALReportData: TActionList;
|
ALReportData: TActionList;
|
||||||
BPVariables: TButtonPanel;
|
BPVariables: TButtonPanel;
|
||||||
CBType: TComboBox;
|
CBType: TComboBox;
|
||||||
|
CBMaster: TComboBox;
|
||||||
EName: TEdit;
|
EName: TEdit;
|
||||||
ILReportdata: TImageList;
|
ILReportdata: TImageList;
|
||||||
|
Label4: TLabel;
|
||||||
LBReportData: TListBox;
|
LBReportData: TListBox;
|
||||||
LENAme: TLabel;
|
LENAme: TLabel;
|
||||||
Label3: TLabel;
|
Label3: TLabel;
|
||||||
@ -55,6 +57,7 @@ type
|
|||||||
procedure ADuplicateUpdate(Sender: TObject);
|
procedure ADuplicateUpdate(Sender: TObject);
|
||||||
procedure APreviewExecute(Sender: TObject);
|
procedure APreviewExecute(Sender: TObject);
|
||||||
procedure APreviewUpdate(Sender: TObject);
|
procedure APreviewUpdate(Sender: TObject);
|
||||||
|
procedure CBMasterChange(Sender: TObject);
|
||||||
procedure CBTypeChange(Sender: TObject);
|
procedure CBTypeChange(Sender: TObject);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
@ -85,6 +88,7 @@ Resourcestring
|
|||||||
SAllowedChars2 = 'The first character must be a letter or underscore';
|
SAllowedChars2 = 'The first character must be a letter or underscore';
|
||||||
SErrIllegalDataName = 'The data source name %s is not a legal data source name.';
|
SErrIllegalDataName = 'The data source name %s is not a legal data source name.';
|
||||||
SWarnDuplicateDataName = 'The data set name %s already exists.';
|
SWarnDuplicateDataName = 'The data set name %s already exists.';
|
||||||
|
SNone = '(none)';
|
||||||
|
|
||||||
{ TReportDataConfigForm }
|
{ TReportDataConfigForm }
|
||||||
|
|
||||||
@ -96,11 +100,15 @@ end;
|
|||||||
|
|
||||||
procedure TReportDataConfigForm.CBTypeChange(Sender: TObject);
|
procedure TReportDataConfigForm.CBTypeChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
ShowDataFrame;
|
ShowDataFrame;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TReportDataConfigForm.ShowDataFrame;
|
procedure TReportDataConfigForm.ShowDataFrame;
|
||||||
|
|
||||||
|
Var
|
||||||
|
M : String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FCurrentHandler);
|
FreeAndNil(FCurrentHandler);
|
||||||
FreeAndNil(FCurrentFrame);
|
FreeAndNil(FCurrentFrame);
|
||||||
@ -112,6 +120,14 @@ begin
|
|||||||
FCurrentFrame.Align:=alClient;
|
FCurrentFrame.Align:=alClient;
|
||||||
if Assigned(FCurrentData) then
|
if Assigned(FCurrentData) then
|
||||||
FCurrentFrame.SetConfig(FCurrentData.Config);
|
FCurrentFrame.SetConfig(FCurrentData.Config);
|
||||||
|
CBMaster.Enabled:=FCurrentHandler.AllowMasterDetail;
|
||||||
|
M:=FCurrentData.Master;
|
||||||
|
if (M<>'') and CBMaster.Enabled then
|
||||||
|
begin
|
||||||
|
CBMaster.ItemIndex:=CBMaster.Items.IndexOf(M);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
CBMaster.ItemIndex:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TReportDataConfigForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure TReportDataConfigForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
@ -275,6 +291,19 @@ begin
|
|||||||
(Sender as TAction).Enabled:=Assigned(ReportDataPreviewClass) and (FCurrentData<>Nil) and (FCurrentFrame<>Nil) and (FCurrentHandler<>Nil);
|
(Sender as TAction).Enabled:=Assigned(ReportDataPreviewClass) and (FCurrentData<>Nil) and (FCurrentFrame<>Nil) and (FCurrentHandler<>Nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TReportDataConfigForm.CBMasterChange(Sender: TObject);
|
||||||
|
|
||||||
|
Var
|
||||||
|
D : String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if CBMaster.ItemIndex<0 then
|
||||||
|
exit;
|
||||||
|
D:=CBMaster.Text;
|
||||||
|
if (D<>'') and (D<>SNone) then
|
||||||
|
Data.CheckCircularReference(D,FCurrentData);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TReportDataConfigForm.FormDestroy(Sender: TObject);
|
procedure TReportDataConfigForm.FormDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FCurrentHandler);
|
FreeAndNil(FCurrentHandler);
|
||||||
@ -342,6 +371,13 @@ begin
|
|||||||
Raise Exception.Create('Internal error : No config frame');
|
Raise Exception.Create('Internal error : No config frame');
|
||||||
FCurrentFrame.GetConfig(FCurrentData.Config);
|
FCurrentFrame.GetConfig(FCurrentData.Config);
|
||||||
end;
|
end;
|
||||||
|
S:='';
|
||||||
|
if CBMaster.Enabled then
|
||||||
|
S:=CBMaster.Text;
|
||||||
|
if (S='') or (S=SNone) then
|
||||||
|
FCurrentData.Master:=''
|
||||||
|
else
|
||||||
|
FCurrentData.Master:=S;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TReportDataConfigForm.ShowSelectedItem;
|
procedure TReportDataConfigForm.ShowSelectedItem;
|
||||||
@ -375,12 +411,15 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
LBReportData.Items.Clear;
|
LBReportData.Items.Clear;
|
||||||
|
CBMaster.Items.Clear;
|
||||||
|
CBMaster.Items.AddObject(SNone,nil);
|
||||||
if Not Assigned(Data) then
|
if Not Assigned(Data) then
|
||||||
exit;
|
exit;
|
||||||
For I:=0 to Data.Count-1 do
|
For I:=0 to Data.Count-1 do
|
||||||
begin
|
begin
|
||||||
S:=Data[i];
|
S:=Data[i];
|
||||||
LBReportData.Items.AddObject(S.Name,S);
|
LBReportData.Items.AddObject(S.Name,S);
|
||||||
|
CBMaster.Items.AddObject(S.Name,S);
|
||||||
end;
|
end;
|
||||||
if Data.Count>0 then
|
if Data.Count>0 then
|
||||||
LBReportData.ItemIndex:=0
|
LBReportData.ItemIndex:=0
|
||||||
|
@ -1137,8 +1137,10 @@ Var
|
|||||||
begin
|
begin
|
||||||
if not Assigned(ReportDataFormClass) then
|
if not Assigned(ReportDataFormClass) then
|
||||||
exit;
|
exit;
|
||||||
|
Self.Report.SaveDataToNames;
|
||||||
F:=ReportDataFormClass.Create(Self);
|
F:=ReportDataFormClass.Create(Self);
|
||||||
try
|
try
|
||||||
|
|
||||||
F.Report:=Self.Report;
|
F.Report:=Self.Report;
|
||||||
F.Data:=FReportDesignData.DataDefinitions;
|
F.Data:=FReportDesignData.DataDefinitions;
|
||||||
if F.ShowModal=mrOK then
|
if F.ShowModal=mrOK then
|
||||||
@ -1419,7 +1421,8 @@ begin
|
|||||||
// Give LCL time to clean up.
|
// Give LCL time to clean up.
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
FReportData.Report:=Nil;
|
FReportData.Report:=Nil;
|
||||||
FReportDesignData.RemoveFromReport(FReport);
|
if Assigned(FReport) then
|
||||||
|
FReportDesignData.RemoveFromReport(FReport);
|
||||||
FReportDesignData.DataDefinitions.Clear;
|
FReportDesignData.DataDefinitions.Clear;
|
||||||
FOI.Report:=Nil;
|
FOI.Report:=Nil;
|
||||||
FOI.SelectControls(Nil);
|
FOI.SelectControls(Nil);
|
||||||
|
Loading…
Reference in New Issue
Block a user