Changeset 15 for trunk/Forms
- Timestamp:
- Jun 13, 2011, 8:25:31 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 4 4 heaptrclog.trc 5 5 chronis.exe 6 DebugLog.txt
-
- Property svn:ignore
-
trunk/Forms/UItemAdd.pas
r14 r15 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 StdCtrls, Spin, EditBtn, MaskEdit, USqlDatabase, USystem; 9 StdCtrls, Spin, EditBtn, MaskEdit, USqlDatabase, USystem, 10 SpecializedDictionary, SpecializedList; 10 11 11 12 type … … 28 29 public 29 30 Report: TReport; 31 ControlList: TListObject; 30 32 end; 31 33 … … 48 50 49 51 procedure TItemAddForm.ButtonSaveClick(Sender: TObject); 52 var 53 Data: TDictionaryStringString; 54 I: Integer; 55 DataType: TDataType; 50 56 begin 57 with Core.System do 58 try 59 Data := TDictionaryStringString.Create; 60 for I := 0 to Report.Columns.Count - 1 do 61 if TReportColumn(Report.Columns[I]).ColumnName <> 'Id' then begin 62 DataType := TReportColumn(Report.Columns[I]).CustomType; 63 Data.Add(TReportColumn(Report.Columns[I]).ColumnName, DataType.GetControlValue(TWinControl(ControlList[I]))); 64 end; 65 Database.Insert(MainForm.SelectedObject.Table, Data, MainForm.SelectedObject.Schema); 66 finally 67 Data.Free; 68 end; 69 MainForm.LoadItemList; 51 70 Close; 52 71 end; … … 62 81 Report := TReport.Create; 63 82 Report.Base := Core.System; 83 ControlList := TListObject.Create; 84 ControlList.OwnsObjects := False; 64 85 end; 65 86 … … 67 88 begin 68 89 Report.Free; 90 ControlList.Free; 69 91 end; 70 92 … … 97 119 98 120 // Load column names 121 ControlList.Clear; 99 122 for I := 0 to Report.Columns.Count - 1 do 100 123 if TReportColumn(Report.Columns[I]).ColumnName <> 'Id' then begin … … 113 136 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 114 137 NewControl.Width := (Width div ColumnCount) div 2 - 20; 138 ControlList.Add(NewControl); 115 139 116 140 Column := (Column + 1) mod 2; 117 141 if Column = 0 then LastTop := LastTop + NewControl.Height + 4; 118 end ;142 end else ControlList.Add(nil); 119 143 end; 120 144 -
trunk/Forms/UItemEdit.pas
r14 r15 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 StdCtrls, Spin, EditBtn, USqlDatabase, MaskEdit, USystem; 9 StdCtrls, Spin, EditBtn, USqlDatabase, MaskEdit, USystem, 10 SpecializedList, SpecializedDictionary; 10 11 11 12 type … … 27 28 public 28 29 Report: TReport; 30 ControlList: TListObject; 29 31 procedure BuildControls; 30 32 end; … … 48 50 49 51 procedure TItemEditForm.ButtonSaveClick(Sender: TObject); 52 var 53 Data: TDictionaryStringString; 54 I: Integer; 55 DataType: TDataType; 50 56 begin 51 57 with Core.System do 58 try 59 Data := TDictionaryStringString.Create; 60 for I := 0 to Report.Columns.Count - 1 do 61 if TReportColumn(Report.Columns[I]).ColumnName <> 'Id' then begin 62 DataType := TReportColumn(Report.Columns[I]).CustomType; 63 Data.Add(TReportColumn(Report.Columns[I]).ColumnName, DataType.GetControlValue(TWinControl(ControlList[I]))); 64 end; 65 Database.Update(MainForm.SelectedObject.Table, Data, 66 '`Id` = ' + IntToStr(MainForm.SelectedItem), MainForm.SelectedObject.Schema); 67 finally 68 Data.Free; 69 end; 70 if (MainForm.SelectedObject.Table = ObjectGroupTable) or 71 (MainForm.SelectedObject.Table = ObjectTable) then 72 MainForm.LoadTree; 52 73 MainForm.LoadItemList; 53 74 Close; … … 64 85 Report := TReport.Create; 65 86 Report.Base := Core.System; 87 ControlList := TListObject.Create; 88 ControlList.OwnsObjects := False; 66 89 end; 67 90 68 91 procedure TItemEditForm.FormDestroy(Sender: TObject); 69 92 begin 93 ControlList.Free; 70 94 Report.Free; 71 95 end; … … 115 139 NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2; 116 140 NewControl.Width := (Width div ColumnCount) div 2 - 20; 141 ControlList.Add(NewControl); 117 142 118 143 Column := (Column + 1) mod 2; 119 144 if Column = 0 then LastTop := LastTop + NewControl.Height + 4; 120 end ;145 end else ControlList.Add(nil); 121 146 end; 122 147 -
trunk/Forms/UMainForm.pas
r14 r15 407 407 ObjectId := AddObject('Object groups', 'ObjectGroup', Core.System.Database.Database, GroupId); 408 408 AddPropertyString(ObjectId, 'Name', 'Name'); 409 AddPropertyNumber(ObjectId, 'Parent', 'Parent'); 409 410 ObjectId := AddObject('Objects', 'Object', Core.System.Database.Database, GroupId); 410 411 AddPropertyString(ObjectId, 'Name', 'Name'); … … 417 418 AddPropertyString(ObjectId, 'Name', 'Name'); 418 419 AddPropertyString(ObjectId, 'Type', 'DbType'); 419 AddPropertyNumber(ObjectId, 'Parent', 'Parent');420 //AddPropertyNumber(ObjectId, 'Parent', 'Parent'); 420 421 ObjectId := AddObject('Property groups', 'PropertyGroup', Core.System.Database.Database, GroupId); 421 422 ObjectId := AddObject('Properties', 'Property', Core.System.Database.Database, GroupId);
Note:
See TracChangeset
for help on using the changeset viewer.