Changeset 17 for trunk/Forms
- Timestamp:
- Jun 13, 2011, 2:35:01 PM (13 years ago)
- Location:
- trunk/Forms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UItemView.lfm
r12 r17 10 10 OnCreate = FormCreate 11 11 OnDestroy = FormDestroy 12 OnResize = FormResize 12 13 OnShow = FormShow 13 14 LCLVersion = '0.9.31' … … 55 56 object TabControl1: TTabControl 56 57 Left = 0 57 Height = 3258 Height = 24 58 59 Top = 0 59 60 Width = 626 60 61 Align = alTop 62 OnChange = TabControl1Change 61 63 TabIndex = 0 62 64 TabOrder = 0 … … 70 72 object ListView1: TListView 71 73 Left = 0 72 Height = 1 6873 Top = 3274 Height = 176 75 Top = 24 74 76 Width = 626 75 77 Align = alClient 76 78 Columns = <> 79 OwnerData = True 80 ReadOnly = True 81 RowSelect = True 77 82 TabOrder = 1 83 ViewStyle = vsReport 84 OnData = ListView1Data 78 85 end 79 86 end -
trunk/Forms/UItemView.pas
r16 r17 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ExtCtrls, ComCtrls, USqlDatabase, USystem ;9 ExtCtrls, ComCtrls, USqlDatabase, USystem, SpecializedList; 10 10 11 11 type … … 28 28 procedure FormCreate(Sender: TObject); 29 29 procedure FormDestroy(Sender: TObject); 30 procedure FormResize(Sender: TObject); 30 31 procedure FormShow(Sender: TObject); 32 procedure ListView1Data(Sender: TObject; Item: TListItem); 33 procedure ListView1Resize(Sender: TObject); 34 procedure TabControl1Change(Sender: TObject); 31 35 private 36 SubListObject: TChronisObject; 37 TabObjectList: TListInteger; 38 TabDataTypeList: TListObject; 39 procedure LoadSubList; 32 40 { private declarations } 33 41 public … … 56 64 procedure TItemViewForm.FormCreate(Sender: TObject); 57 65 begin 66 SubListObject := TChronisObject.Create; 67 SubListObject.Base := Core.System; 58 68 Report := TReport.Create; 59 69 Report.Base := Core.System; 70 TabObjectList := TListInteger.Create; 71 TabDataTypeList := TListObject.Create; 72 TabDataTypeList.OwnsObjects := False; 73 TabControl1.Tabs.Clear; 60 74 end; 61 75 62 76 procedure TItemViewForm.FormDestroy(Sender: TObject); 63 77 begin 78 SubListObject.Free; 64 79 Report.Free; 80 TabObjectList.Free; 81 TabDataTypeList.Free; 82 end; 83 84 procedure TItemViewForm.FormResize(Sender: TObject); 85 begin 86 ListView1Resize(Self); 65 87 end; 66 88 … … 85 107 MainForm.PersistentForm.Load(Self); 86 108 BuildControls; 109 LoadSubList; 110 end; 111 112 procedure TItemViewForm.ListView1Data(Sender: TObject; Item: TListItem); 113 var 114 I: Integer; 115 begin 116 if Item.Index < Report.Count then 117 with TReportLine(Report[Item.Index]) do begin 118 Item.Caption := Items[0]; 119 for I := 1 to Items.Count - 1 do 120 if not TReportColumn(Report.Columns[I]).VirtualItem then 121 Item.SubItems.Add(Items[I]); 122 end; 87 123 end; 88 124 … … 105 141 106 142 TabControl1.Tabs.Clear; 143 TabObjectList.Clear; 144 TabDataTypeList.Clear; 107 145 // Load column names 108 146 … … 110 148 for I := 0 to Report.Columns.Count - 1 do begin 111 149 DataType := TReportColumn(Report.Columns[I]).CustomType; 150 DataType.LoadDef(TReportColumn(Report.Columns[I]).CustomType.CustomType); 112 151 if DataType is TDataTypeRelationMany then begin 113 152 TabControl1.Tabs.Add(TReportColumn(Report.Columns[I]).Caption); 153 TabDataTypeList.Add(DataType); 154 TabObjectList.Add(MainForm.SelectedItem); 114 155 end else begin 115 156 NewControl := TLabel.Create(PanelControls); … … 132 173 end; 133 174 175 procedure TItemViewForm.LoadSubList; 176 var 177 NewColumn: TListColumn; 178 I: Integer; 179 begin 180 //SelectedObjectId := 0; 181 if (TabControl1.TabIndex >= 0) and (TabControl1.TabIndex < TabControl1.Tabs.Count) then 182 with ListView1 do 183 with TDataTypeRelationMany(TabDataTypeList[TabControl1.TabIndex]) do begin 184 Visible := True; 185 SubListObject.Load(ObjectId); 186 Report.Load(SubListObject, '`' + PropertyName + '`=' + IntToStr(TabObjectList[TabControl1.TabIndex])); 187 188 Columns.Clear; 189 for I := 0 to Report.Columns.Count - 1 do 190 if not TReportColumn(Report.Columns[I]).VirtualItem then begin 191 NewColumn := Columns.Add; 192 NewColumn.Caption := TReportColumn(Report.Columns[I]).Caption; 193 end; 194 Items.Count := Report.Count; 195 Refresh; 196 end; 197 ListView1Resize(Self); 198 end; 199 200 procedure TItemViewForm.ListView1Resize(Sender: TObject); 201 var 202 I: Integer; 203 begin 204 for I := 0 to ListView1.Columns.Count - 1 do 205 ListView1.Columns[I].Width := ListView1.Width div ListView1.Columns.Count; 206 end; 207 208 procedure TItemViewForm.TabControl1Change(Sender: TObject); 209 begin 210 LoadSubList; 211 end; 212 213 134 214 end. 135 215 -
trunk/Forms/UMainForm.pas
r16 r17 440 440 ObjectPropertyId := AddObject('Properties', 'Property', Core.System.Database.Database, GroupId); 441 441 AddPropertyString(ObjectPropertyId, 'Name', 'Name'); 442 Property ObjectId := AddPropertyRelationOne(ObjectPropertyId, 'Object', 'Object', ObjectId);442 PropertyParentId := AddPropertyRelationOne(ObjectPropertyId, 'Object', 'Object', ObjectId); 443 443 ObjectPropertyIdGroup := AddPropertyRelationOne(ObjectPropertyId, 'Property group', 'PropertyGroup', ObjectPropertyGroupId); 444 444 AddPropertyNumber(ObjectPropertyId, 'Custom type', 'CustomType'); … … 597 597 with TReportLine(Report[Item.Index]) do begin 598 598 Item.Caption := Items[0]; 599 for I := 1 to Items.Count - 1 do600 if not TReportColumn(Report.Columns[I]).VirtualItem then 599 for I := 1 to Report.Columns.Count - 1 do 600 if not TReportColumn(Report.Columns[I]).VirtualItem then begin 601 601 Item.SubItems.Add(Items[I]); 602 end; 602 603 end; 603 604 end;
Note:
See TracChangeset
for help on using the changeset viewer.