DataSet State 변경 및 파일저장
This commit is contained in:
+313
-30
@@ -18,83 +18,225 @@ object frmMain: TfrmMain
|
||||
Height = 601
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
LayoutLookAndFeel = dxLayoutSkinLookAndFeel1
|
||||
ExplicitLeft = 104
|
||||
ExplicitTop = 72
|
||||
ExplicitWidth = 300
|
||||
ExplicitHeight = 250
|
||||
object btnAdd: TcxButton
|
||||
Left = 405
|
||||
Top = 33
|
||||
Left = 337
|
||||
Top = 12
|
||||
Width = 75
|
||||
Height = 35
|
||||
Caption = 'btnAdd'
|
||||
Action = acAdd
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnSave: TcxButton
|
||||
Left = 487
|
||||
Top = 33
|
||||
Left = 501
|
||||
Top = 12
|
||||
Width = 75
|
||||
Height = 35
|
||||
Caption = 'btnSave'
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnDelete: TcxButton
|
||||
Left = 569
|
||||
Top = 33
|
||||
Width = 75
|
||||
Height = 35
|
||||
Caption = 'btnDelete'
|
||||
Action = acSave
|
||||
TabOrder = 2
|
||||
end
|
||||
object btnCancel: TcxButton
|
||||
Left = 651
|
||||
Top = 33
|
||||
object btnDelete: TcxButton
|
||||
Left = 583
|
||||
Top = 12
|
||||
Width = 75
|
||||
Height = 35
|
||||
Caption = 'btnCancel'
|
||||
Action = acDelete
|
||||
TabOrder = 3
|
||||
end
|
||||
object grdEmployee: TcxGrid
|
||||
Left = 26
|
||||
Top = 152
|
||||
Width = 700
|
||||
Height = 200
|
||||
object btnCancel: TcxButton
|
||||
Left = 665
|
||||
Top = 12
|
||||
Width = 75
|
||||
Height = 35
|
||||
Action = acCancel
|
||||
TabOrder = 4
|
||||
end
|
||||
object grdEmployee: TcxGrid
|
||||
Left = 12
|
||||
Top = 205
|
||||
Width = 728
|
||||
Height = 384
|
||||
TabOrder = 11
|
||||
object dbtvEmployee: TcxGridDBTableView
|
||||
Navigator.Buttons.CustomButtons = <>
|
||||
ScrollbarAnnotations.CustomAnnotations = <>
|
||||
DataController.DataSource = dmData.dsEmployee
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsData.CancelOnExit = False
|
||||
OptionsData.Deleting = False
|
||||
OptionsData.DeletingConfirmation = False
|
||||
OptionsData.Editing = False
|
||||
OptionsData.Inserting = False
|
||||
OptionsSelection.CellSelect = False
|
||||
OptionsView.ColumnAutoWidth = True
|
||||
OptionsView.GroupByBox = False
|
||||
OptionsView.HeaderHeight = 30
|
||||
object dbtvEmployeeRecId: TcxGridDBColumn
|
||||
DataBinding.FieldName = 'RecId'
|
||||
Visible = False
|
||||
end
|
||||
object dbtvEmployeename: TcxGridDBColumn
|
||||
Caption = #51060#47492
|
||||
DataBinding.FieldName = 'name'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taCenter
|
||||
HeaderAlignmentHorz = taCenter
|
||||
end
|
||||
object dbtvEmployeeage: TcxGridDBColumn
|
||||
Caption = #45208#51060
|
||||
DataBinding.FieldName = 'age'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taCenter
|
||||
HeaderAlignmentHorz = taCenter
|
||||
end
|
||||
object dbtvEmployeesalary: TcxGridDBColumn
|
||||
Caption = #44553#50668
|
||||
DataBinding.FieldName = 'salary'
|
||||
PropertiesClassName = 'TcxCurrencyEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
end
|
||||
object dbtvEmployeesex: TcxGridDBColumn
|
||||
Caption = #49457#48324
|
||||
DataBinding.FieldName = 'sex'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
end
|
||||
object dbtvEmployeeposition: TcxGridDBColumn
|
||||
Caption = #51649#50948
|
||||
DataBinding.FieldName = 'position'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taCenter
|
||||
HeaderAlignmentHorz = taCenter
|
||||
end
|
||||
object dbtvEmployeeaddress: TcxGridDBColumn
|
||||
Caption = #51452#49548
|
||||
DataBinding.FieldName = 'address'
|
||||
end
|
||||
end
|
||||
object grdEmployeeDBTableView1: TcxGridDBTableView
|
||||
Navigator.Buttons.CustomButtons = <>
|
||||
ScrollbarAnnotations.CustomAnnotations = <>
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsView.GroupByBox = False
|
||||
end
|
||||
object grdEmployeeLevel1: TcxGridLevel
|
||||
GridView = dbtvEmployee
|
||||
end
|
||||
end
|
||||
object btnEdit: TcxButton
|
||||
Left = 419
|
||||
Top = 12
|
||||
Width = 75
|
||||
Height = 35
|
||||
Action = acEdit
|
||||
TabOrder = 1
|
||||
end
|
||||
object dbteName: TcxDBTextEdit
|
||||
Left = 55
|
||||
Top = 93
|
||||
AutoSize = False
|
||||
DataBinding.DataField = 'name'
|
||||
DataBinding.DataSource = dmData.dsEmployee
|
||||
Style.HotTrack = False
|
||||
Style.TransparentBorder = False
|
||||
TabOrder = 5
|
||||
Height = 25
|
||||
Width = 318
|
||||
end
|
||||
object dbseAge: TcxDBSpinEdit
|
||||
Left = 447
|
||||
Top = 125
|
||||
AutoSize = False
|
||||
DataBinding.DataField = 'age'
|
||||
DataBinding.DataSource = dmData.dsEmployee
|
||||
Style.HotTrack = False
|
||||
Style.TransparentBorder = False
|
||||
TabOrder = 9
|
||||
Height = 25
|
||||
Width = 279
|
||||
end
|
||||
object dbseSalary: TcxDBSpinEdit
|
||||
Left = 55
|
||||
Top = 125
|
||||
AutoSize = False
|
||||
DataBinding.DataField = 'salary'
|
||||
DataBinding.DataSource = dmData.dsEmployee
|
||||
Properties.AssignedValues.EditFormat = True
|
||||
Style.HotTrack = False
|
||||
Style.TransparentBorder = False
|
||||
TabOrder = 7
|
||||
Height = 25
|
||||
Width = 279
|
||||
end
|
||||
object cxDBCheckBox1: TcxDBCheckBox
|
||||
Left = 341
|
||||
Top = 125
|
||||
AutoSize = False
|
||||
Caption = #49457#48324
|
||||
DataBinding.DataField = 'sex'
|
||||
DataBinding.DataSource = dmData.dsEmployee
|
||||
Properties.Alignment = taRightJustify
|
||||
Style.HotTrack = False
|
||||
Style.TransparentBorder = False
|
||||
TabOrder = 8
|
||||
Transparent = True
|
||||
Height = 25
|
||||
Width = 70
|
||||
end
|
||||
object dbtePosition: TcxDBTextEdit
|
||||
Left = 409
|
||||
Top = 93
|
||||
AutoSize = False
|
||||
DataBinding.DataField = 'position'
|
||||
DataBinding.DataSource = dmData.dsEmployee
|
||||
Style.HotTrack = False
|
||||
Style.TransparentBorder = False
|
||||
TabOrder = 6
|
||||
Height = 25
|
||||
Width = 317
|
||||
end
|
||||
object dbteAdress: TcxDBTextEdit
|
||||
Left = 55
|
||||
Top = 157
|
||||
DataBinding.DataField = 'address'
|
||||
DataBinding.DataSource = dmData.dsEmployee
|
||||
Style.HotTrack = False
|
||||
Style.TransparentBorder = False
|
||||
TabOrder = 10
|
||||
Width = 671
|
||||
end
|
||||
object lgRoot: TdxLayoutGroup
|
||||
AlignHorz = ahParentManaged
|
||||
AlignVert = avParentManaged
|
||||
Hidden = True
|
||||
ItemIndex = 2
|
||||
ItemIndex = 1
|
||||
ShowBorder = False
|
||||
Index = -1
|
||||
end
|
||||
object lgToolbar: TdxLayoutGroup
|
||||
Parent = lgRoot
|
||||
CaptionOptions.Text = 'New Group'
|
||||
ItemIndex = 3
|
||||
ItemIndex = 1
|
||||
LayoutDirection = ldHorizontal
|
||||
ShowBorder = False
|
||||
Index = 0
|
||||
end
|
||||
object lgInput: TdxLayoutGroup
|
||||
Parent = lgRoot
|
||||
CaptionOptions.Text = 'New Group'
|
||||
CaptionOptions.Text = ' '#51077#47141' '
|
||||
Index = 1
|
||||
end
|
||||
object lgGrid: TdxLayoutGroup
|
||||
Parent = lgRoot
|
||||
AlignVert = avClient
|
||||
CaptionOptions.Text = 'New Group'
|
||||
ShowBorder = False
|
||||
Index = 2
|
||||
end
|
||||
object liAdd: TdxLayoutItem
|
||||
@@ -117,7 +259,8 @@ object frmMain: TfrmMain
|
||||
ControlOptions.OriginalHeight = 35
|
||||
ControlOptions.OriginalWidth = 75
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 1
|
||||
Enabled = False
|
||||
Index = 2
|
||||
end
|
||||
object liDelete: TdxLayoutItem
|
||||
Parent = lgToolbar
|
||||
@@ -128,7 +271,7 @@ object frmMain: TfrmMain
|
||||
ControlOptions.OriginalHeight = 35
|
||||
ControlOptions.OriginalWidth = 75
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 2
|
||||
Index = 3
|
||||
end
|
||||
object liCancel: TdxLayoutItem
|
||||
Parent = lgToolbar
|
||||
@@ -139,10 +282,11 @@ object frmMain: TfrmMain
|
||||
ControlOptions.OriginalHeight = 35
|
||||
ControlOptions.OriginalWidth = 75
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 3
|
||||
Index = 4
|
||||
end
|
||||
object liGrid: TdxLayoutItem
|
||||
Parent = lgGrid
|
||||
AlignVert = avClient
|
||||
CaptionOptions.Text = 'cxGrid2'
|
||||
CaptionOptions.Visible = False
|
||||
Control = grdEmployee
|
||||
@@ -151,5 +295,144 @@ object frmMain: TfrmMain
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 0
|
||||
end
|
||||
object liEdit: TdxLayoutItem
|
||||
Parent = lgToolbar
|
||||
AlignHorz = ahRight
|
||||
AlignVert = avClient
|
||||
CaptionOptions.Text = 'cxButton1'
|
||||
CaptionOptions.Visible = False
|
||||
Control = btnEdit
|
||||
ControlOptions.OriginalHeight = 35
|
||||
ControlOptions.OriginalWidth = 75
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 1
|
||||
end
|
||||
object liName: TdxLayoutItem
|
||||
Parent = dxLayoutGroup1
|
||||
AlignHorz = ahClient
|
||||
CaptionOptions.Text = #51060#47492
|
||||
Control = dbteName
|
||||
ControlOptions.OriginalHeight = 25
|
||||
ControlOptions.OriginalWidth = 121
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 0
|
||||
end
|
||||
object liAge: TdxLayoutItem
|
||||
Parent = dxLayoutGroup3
|
||||
AlignHorz = ahClient
|
||||
CaptionOptions.Text = #45208#51060
|
||||
Control = dbseAge
|
||||
ControlOptions.OriginalHeight = 25
|
||||
ControlOptions.OriginalWidth = 121
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 2
|
||||
end
|
||||
object liSalary: TdxLayoutItem
|
||||
Parent = dxLayoutGroup3
|
||||
AlignHorz = ahClient
|
||||
CaptionOptions.Text = #44553#50668
|
||||
Control = dbseSalary
|
||||
ControlOptions.OriginalHeight = 25
|
||||
ControlOptions.OriginalWidth = 121
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 0
|
||||
end
|
||||
object liSex: TdxLayoutItem
|
||||
Parent = dxLayoutGroup3
|
||||
AlignHorz = ahClient
|
||||
CaptionOptions.Text = 'sex'
|
||||
CaptionOptions.Visible = False
|
||||
Control = cxDBCheckBox1
|
||||
ControlOptions.OriginalHeight = 25
|
||||
ControlOptions.OriginalWidth = 34
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 1
|
||||
end
|
||||
object liPosition: TdxLayoutItem
|
||||
Parent = dxLayoutGroup1
|
||||
AlignHorz = ahClient
|
||||
CaptionOptions.Text = #51649#50948
|
||||
Control = dbtePosition
|
||||
ControlOptions.OriginalHeight = 25
|
||||
ControlOptions.OriginalWidth = 121
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 1
|
||||
end
|
||||
object liAddress: TdxLayoutItem
|
||||
Parent = dxLayoutGroup2
|
||||
CaptionOptions.Text = #51452#49548
|
||||
Control = dbteAdress
|
||||
ControlOptions.OriginalHeight = 27
|
||||
ControlOptions.OriginalWidth = 121
|
||||
ControlOptions.ShowBorder = False
|
||||
Index = 0
|
||||
end
|
||||
object dxLayoutGroup1: TdxLayoutGroup
|
||||
Parent = lgInput
|
||||
CaptionOptions.Text = 'New Group'
|
||||
ItemIndex = 1
|
||||
LayoutDirection = ldHorizontal
|
||||
ShowBorder = False
|
||||
Index = 0
|
||||
end
|
||||
object dxLayoutGroup2: TdxLayoutGroup
|
||||
Parent = lgInput
|
||||
CaptionOptions.Text = 'New Group'
|
||||
ShowBorder = False
|
||||
Index = 2
|
||||
end
|
||||
object dxLayoutGroup3: TdxLayoutGroup
|
||||
Parent = lgInput
|
||||
CaptionOptions.Text = 'New Group'
|
||||
ItemIndex = 2
|
||||
LayoutDirection = ldHorizontal
|
||||
ShowBorder = False
|
||||
Index = 1
|
||||
end
|
||||
end
|
||||
object alToolbar: TActionList
|
||||
Images = dmData.liSmallIcons
|
||||
Left = 200
|
||||
Top = 24
|
||||
object acAdd: TAction
|
||||
Caption = #52628#44032
|
||||
ImageIndex = 0
|
||||
OnExecute = acAddExecute
|
||||
end
|
||||
object acEdit: TAction
|
||||
Caption = #49688#51221
|
||||
ImageIndex = 1
|
||||
OnExecute = acEditExecute
|
||||
end
|
||||
object acSave: TAction
|
||||
Caption = #51200#51109
|
||||
Enabled = False
|
||||
ImageIndex = 2
|
||||
OnExecute = acSaveExecute
|
||||
end
|
||||
object acDelete: TAction
|
||||
Caption = #49325#51228
|
||||
ImageIndex = 3
|
||||
OnExecute = acDeleteExecute
|
||||
end
|
||||
object acCancel: TAction
|
||||
Caption = #52712#49548
|
||||
ImageIndex = 4
|
||||
OnExecute = acCancelExecute
|
||||
end
|
||||
end
|
||||
object scMain: TdxSkinController
|
||||
NativeStyle = False
|
||||
SkinName = 'WXI'
|
||||
SkinPaletteName = 'Clearness'
|
||||
Left = 16
|
||||
Top = 8
|
||||
end
|
||||
object dxLayoutLookAndFeelList: TdxLayoutLookAndFeelList
|
||||
Left = 40
|
||||
Top = 8
|
||||
object dxLayoutSkinLookAndFeel1: TdxLayoutSkinLookAndFeel
|
||||
PixelsPerInch = 96
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+78
-4
@@ -1,16 +1,22 @@
|
||||
unit MainUnit;
|
||||
unit MainUnit;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{ Delphi }
|
||||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, dxUIAClasses, cxControls,
|
||||
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinWXI,
|
||||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
|
||||
|
||||
{ DevExpress }
|
||||
cxGraphics, dxUIAClasses, cxControls, dxCore, dxLayoutLookAndFeels,
|
||||
dxSkinsForm, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinWXI,
|
||||
dxLayoutControlAdapters, dxLayoutContainer, Vcl.Menus, cxStyles, cxCustomData,
|
||||
cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator, dxDateRanges,
|
||||
dxScrollbarAnnotations, Data.DB, cxDBData, cxGridLevel, cxClasses,
|
||||
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||||
cxGrid, Vcl.StdCtrls, cxButtons, dxLayoutControl;
|
||||
cxGrid, Vcl.StdCtrls, cxButtons, dxLayoutControl, System.Actions, Vcl.ActnList,
|
||||
dxLayoutcxEditAdapters, cxContainer, cxCheckBox, cxDBEdit, cxMaskEdit,
|
||||
cxSpinEdit, cxTextEdit, cxCurrencyEdit;
|
||||
|
||||
type
|
||||
TfrmMain = class(TForm)
|
||||
@@ -31,6 +37,45 @@ type
|
||||
grdEmployeeLevel1: TcxGridLevel;
|
||||
grdEmployee: TcxGrid;
|
||||
liGrid: TdxLayoutItem;
|
||||
btnEdit: TcxButton;
|
||||
liEdit: TdxLayoutItem;
|
||||
alToolbar: TActionList;
|
||||
acAdd: TAction;
|
||||
acEdit: TAction;
|
||||
acSave: TAction;
|
||||
acDelete: TAction;
|
||||
acCancel: TAction;
|
||||
dbtvEmployeeRecId: TcxGridDBColumn;
|
||||
dbtvEmployeename: TcxGridDBColumn;
|
||||
dbtvEmployeeage: TcxGridDBColumn;
|
||||
dbtvEmployeesalary: TcxGridDBColumn;
|
||||
dbtvEmployeesex: TcxGridDBColumn;
|
||||
dbtvEmployeeposition: TcxGridDBColumn;
|
||||
dbtvEmployeeaddress: TcxGridDBColumn;
|
||||
dbteName: TcxDBTextEdit;
|
||||
liName: TdxLayoutItem;
|
||||
dbseAge: TcxDBSpinEdit;
|
||||
liAge: TdxLayoutItem;
|
||||
dbseSalary: TcxDBSpinEdit;
|
||||
liSalary: TdxLayoutItem;
|
||||
cxDBCheckBox1: TcxDBCheckBox;
|
||||
liSex: TdxLayoutItem;
|
||||
dbtePosition: TcxDBTextEdit;
|
||||
liPosition: TdxLayoutItem;
|
||||
dbteAdress: TcxDBTextEdit;
|
||||
liAddress: TdxLayoutItem;
|
||||
dxLayoutGroup1: TdxLayoutGroup;
|
||||
dxLayoutGroup2: TdxLayoutGroup;
|
||||
dxLayoutGroup3: TdxLayoutGroup;
|
||||
scMain: TdxSkinController;
|
||||
dxLayoutLookAndFeelList: TdxLayoutLookAndFeelList;
|
||||
dxLayoutSkinLookAndFeel1: TdxLayoutSkinLookAndFeel;
|
||||
grdEmployeeDBTableView1: TcxGridDBTableView;
|
||||
procedure acAddExecute(Sender: TObject);
|
||||
procedure acEditExecute(Sender: TObject);
|
||||
procedure acSaveExecute(Sender: TObject);
|
||||
procedure acDeleteExecute(Sender: TObject);
|
||||
procedure acCancelExecute(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
@@ -44,4 +89,33 @@ implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
EmployeeUnit;
|
||||
|
||||
procedure TfrmMain.acAddExecute(Sender: TObject);
|
||||
begin
|
||||
dmData.mdEmployee.Append;
|
||||
dbteName.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.acCancelExecute(Sender: TObject);
|
||||
begin
|
||||
dmData.mdEmployee.Cancel;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.acDeleteExecute(Sender: TObject);
|
||||
begin
|
||||
dmData.mdEmployee.Delete;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.acEditExecute(Sender: TObject);
|
||||
begin
|
||||
dmData.mdEmployee.Edit;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.acSaveExecute(Sender: TObject);
|
||||
begin
|
||||
dmData.mdEmployee.Post;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
object Form1: TForm1
|
||||
Left = 0
|
||||
Top = 0
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 441
|
||||
ClientWidth = 624
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Segoe UI'
|
||||
Font.Style = []
|
||||
TextHeight = 15
|
||||
end
|
||||
Reference in New Issue
Block a user