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