Building a C++ VCL Customer/Sales Master/Detail/Charting Application with 1 Line of Code
object MasterDetailForm: TMasterDetailForm
Left = 0
Top = 0
Caption = ‘Customer and Orders Master Detail Using Live Bindings (C++ VCL)’
ClientHeight = 509
ClientWidth = 736
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = –11
Font.Name = ‘Tahoma’
Font.Style = []
OldCreateOrder = False
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Splitter1: TSplitter
Left = 0
Top = 161
Width = 736
Height = 3
Cursor = crVSplit
Align = alTop
ExplicitLeft = 24
ExplicitTop = 210
ExplicitWidth = 159
end
object Panel1: TPanel
Left = 0
Top = 0
Width = 736
Height = 33
Align = alTop
TabOrder = 0
object DBNavigator1: TDBNavigator
Left = 159
Top = 4
Width = 225
Height = 23
DataSource = CustomerDataSource
VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast, nbRefresh]
TabOrder = 0
end
object DatabaseActiveCheckBox: TCheckBox
Left = 24
Top = 9
Width = 97
Height = 17
Caption = ‘Database Active’
TabOrder = 1
end
end
object CustomerDBGrid: TDBGrid
Left = 0
Top = 33
Width = 736
Height = 128
Align = alTop
DataSource = CustomerDataSource
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = –11
TitleFont.Name = ‘Tahoma’
TitleFont.Style = []
end
object Panel2: TPanel
Left = 0
Top = 164
Width = 736
Height = 345
Align = alClient
TabOrder = 2
object Splitter2: TSplitter
Left = 305
Top = 1
Height = 343
ExplicitLeft = 208
ExplicitTop = 120
ExplicitHeight = 100
end
object SalesDBGrid: TDBGrid
Left = 1
Top = 1
Width = 304
Height = 343
Align = alLeft
DataSource = SalesDataSource
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = –11
TitleFont.Name = ‘Tahoma’
TitleFont.Style = []
end
object DBChart1: TDBChart
Left = 308
Top = 1
Width = 427
Height = 343
Title.Text.Strings = (
‘Sales by Item Type for Customer’)
View3DOptions.Elevation = 315
View3DOptions.Orthogonal = False
View3DOptions.Perspective = 0
View3DOptions.Rotation = 360
Align = alClient
TabOrder = 1
DefaultCanvas = ‘TGDIPlusCanvas’
ColorPaletteIndex = 13
object Series1: TPieSeries
DataSource = SalesByItemTypeForCustomerQuery
XLabelsSource = ‘ITEM_TYPE’
XValues.Order = loAscending
YValues.Name = ‘Pie’
YValues.Order = loNone
YValues.ValueSource = ‘SUM’
Frame.InnerBrush.BackColor = clRed
Frame.InnerBrush.Gradient.EndColor = clGray
Frame.InnerBrush.Gradient.MidColor = clWhite
Frame.InnerBrush.Gradient.StartColor = 4210752
Frame.InnerBrush.Gradient.Visible = True
Frame.MiddleBrush.BackColor = clYellow
Frame.MiddleBrush.Gradient.EndColor = 8553090
Frame.MiddleBrush.Gradient.MidColor = clWhite
Frame.MiddleBrush.Gradient.StartColor = clGray
Frame.MiddleBrush.Gradient.Visible = True
Frame.OuterBrush.BackColor = clGreen
Frame.OuterBrush.Gradient.EndColor = 4210752
Frame.OuterBrush.Gradient.MidColor = clWhite
Frame.OuterBrush.Gradient.StartColor = clSilver
Frame.OuterBrush.Gradient.Visible = True
Frame.Width = 4
OtherSlice.Legend.Visible = False
end
end
end
object DatabaseConnection: TFDConnection
Params.Strings = (
‘Database=C:UsersPublicDocumentsEmbarcaderoStudio21.0Sampl’ +
‘esDataEMPLOYEE.GDB’
‘ConnectionDef=EMPLOYEE’)
Connected = True
LoginPrompt = False
Left = 104
Top = 64
end
object CustomerQuery: TFDQuery
AfterScroll = CustomerQueryAfterScroll
Connection = DatabaseConnection
SQL.Strings = (
‘select * from customer’)
Left = 240
Top = 72
object CustomerQueryCUST_NO: TFDAutoIncField
FieldName = ‘CUST_NO’
Origin = ‘CUST_NO’
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
IdentityInsert = True
end
object CustomerQueryCUSTOMER: TStringField
FieldName = ‘CUSTOMER’
Origin = ‘CUSTOMER’
Required = True
Size = 25
end
object CustomerQueryCITY: TStringField
FieldName = ‘CITY’
Origin = ‘CITY’
Size = 25
end
object CustomerQuerySTATE_PROVINCE: TStringField
FieldName = ‘STATE_PROVINCE’
Origin = ‘STATE_PROVINCE’
Size = 15
end
object CustomerQueryCOUNTRY: TStringField
FieldName = ‘COUNTRY’
Origin = ‘COUNTRY’
Size = 15
end
object CustomerQueryPOSTAL_CODE: TStringField
FieldName = ‘POSTAL_CODE’
Origin = ‘POSTAL_CODE’
Size = 12
end
object CustomerQueryON_HOLD: TStringField
AutoGenerateValue = arDefault
FieldName = ‘ON_HOLD’
Origin = ‘ON_HOLD’
FixedChar = True
Size = 1
end
end
object CustomerDataSource: TDataSource
DataSet = CustomerQuery
Left = 341
Top = 72
end
object SalesQuery: TFDQuery
MasterSource = CustomerDataSource
MasterFields = ‘CUST_NO’
DetailFields = ‘CUST_NO’
Connection = DatabaseConnection
FetchOptions.AssignedValues = [evCache]
FetchOptions.Cache = [fiBlobs, fiMeta]
UpdateOptions.AssignedValues = [uvRefreshMode]
SQL.Strings = (
‘select * from sales’
‘where :Cust_NO = Cust_No’)
Left = 79
Top = 240
ParamData = <
item
Name = ‘CUST_NO’
DataType = ftInteger
ParamType = ptInput
Value = 1001
end>
object SalesQueryCUST_NO: TIntegerField
DisplayLabel = ‘CUST#’
FieldName = ‘CUST_NO’
Origin = ‘CUST_NO’
Required = True
end
object SalesQueryORDER_DATE: TSQLTimeStampField
AutoGenerateValue = arDefault
DisplayLabel = ‘ORD_DATE’
DisplayWidth = 10
FieldName = ‘ORDER_DATE’
Origin = ‘ORDER_DATE’
end
object SalesQueryTOTAL_VALUE: TCurrencyField
FieldName = ‘TOTAL_VALUE’
Origin = ‘TOTAL_VALUE’
Required = True
end
object SalesQueryITEM_TYPE: TStringField
FieldName = ‘ITEM_TYPE’
Origin = ‘ITEM_TYPE’
Required = True
Size = 12
end
end
object SalesDataSource: TDataSource
DataSet = SalesQuery
Left = 184
Top = 240
end
object BindingsList1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 628
Top = 69
object LinkControlToPropertyActive: TLinkControlToProperty
Category = ‘Quick Bindings’
Control = DatabaseActiveCheckBox
Track = True
Component = CustomerQuery
ComponentProperty = ‘Active’
end
object LinkControlToPropertyActive2: TLinkControlToProperty
Category = ‘Quick Bindings’
Control = DatabaseActiveCheckBox
Track = True
Component = SalesQuery
ComponentProperty = ‘Active’
InitializeControlValue = False
end
object LinkControlToPropertyActive3: TLinkControlToProperty
Category = ‘Quick Bindings’
Control = DatabaseActiveCheckBox
Track = True
Component = SalesByItemTypeForCustomerQuery
ComponentProperty = ‘Active’
InitializeControlValue = False
end
end
object SalesByItemTypeForCustomerQuery: TFDQuery
MasterSource = CustomerDataSource
MasterFields = ‘CUST_NO’
Connection = DatabaseConnection
UpdateOptions.AssignedValues = [uvRefreshMode]
SQL.Strings = (
‘select Item_Type,sum(Total_Value) from Sales’
‘where Cust_NO = :Cust_No’
‘Group by Item_type’)
Left = 128
Top = 320
ParamData = <
item
Name = ‘CUST_NO’
DataType = ftInteger
ParamType = ptInput
Value = Null
end>
object SalesByItemTypeForCustomerQueryITEM_TYPE: TStringField
AutoGenerateValue = arDefault
FieldName = ‘ITEM_TYPE’
Origin = ‘ITEM_TYPE’
ProviderFlags = []
ReadOnly = True
Size = 12
end
object SalesByItemTypeForCustomerQuerySUM: TFMTBCDField
AutoGenerateValue = arDefault
FieldName = ‘SUM’
Origin = ‘”SUM”‘
ProviderFlags = []
ReadOnly = True
Precision = 18
Size = 2
end
end
end