Changeset 31 for trunk/Forms/UItemEdit.pas
- Timestamp:
- Nov 24, 2011, 10:03:48 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UItemEdit.pas
r30 r31 46 46 procedure TabControl1Change(Sender: TObject); 47 47 private 48 SelectedItem: Integer;49 48 SubListObject: TChronisObject; 50 49 TabObjectList: TListInteger; … … 52 51 procedure LoadSubList; 53 52 public 53 SelectedObject: TChronisObject; 54 SelectedItemId: Integer; 54 55 Report: TReport; 55 56 procedure BuildControls; … … 88 89 procedure TItemEditForm.ButtonAddClick(Sender: TObject); 89 90 begin 90 if Assigned(ListView1.Selected) then 91 ItemAddForm.Show; 91 ItemAddForm.Show; 92 92 end; 93 93 … … 99 99 with TReportLine(Report[Item.Index]) do begin 100 100 Item.Caption := Items[0]; 101 Item.Data := Pointer(Id); 101 102 for I := 1 to Items.Count - 1 do 102 103 if not TReportColumn(Report.Columns[I]).VirtualItem then … … 127 128 for I := 0 to Report.Columns.Count - 1 do 128 129 if not (TReportColumn(Report.Columns[I]).CustomType is TDataTypeRelationMany) then 129 if TReportColumn(Report.Columns[I]).ColumnName <> MainForm.SelectedObject.PrimaryKey then begin130 if TReportColumn(Report.Columns[I]).ColumnName <> SelectedObject.PrimaryKey then begin 130 131 DataType := TReportColumn(Report.Columns[I]).CustomType; 131 132 Data.Add(TReportColumn(Report.Columns[I]).ColumnName, 132 133 DataType.GetControlValue(TWinControl(TReportColumn(Report.Columns[I]).Control))); 133 134 end; 134 Database.Update( MainForm.SelectedObject.Table, Data,135 '`' + MainForm.SelectedObject.PrimaryKey + '` = ' + IntToStr(MainForm.SelectedItem), MainForm.SelectedObject.Schema);135 Database.Update(SelectedObject.Table, Data, 136 '`' + SelectedObject.PrimaryKey + '` = ' + IntToStr(SelectedItemId), SelectedObject.Schema); 136 137 finally 137 138 Data.Free; 138 139 end; 139 if ( MainForm.SelectedObject.Table = ObjectGroupTable) or140 ( MainForm.SelectedObject.Table = ObjectTable) then140 if (SelectedObject.Table = ObjectGroupTable) or 141 (SelectedObject.Table = ObjectTable) then 141 142 MainForm.LoadTree; 142 MainForm.LoadItemList;143 //MainForm.LoadItemList; 143 144 Close; 144 145 end; … … 166 167 TabDataTypeList.OwnsObjects := False; 167 168 TabControl1.Tabs.Clear; 169 SelectedObject := TChronisObject.Create; 170 SelectedObject.Base := Core.System; 168 171 end; 169 172 … … 174 177 TabObjectList.Free; 175 178 TabDataTypeList.Free; 179 SelectedObject.Free; 176 180 end; 177 181 … … 197 201 LastTop := 8; 198 202 Column := 0; 199 Report.Load( MainForm.SelectedObject, MainForm.SelectedObject.PrimaryKey + ' = ' +200 IntToStr( MainForm.SelectedItem));203 Report.Load(SelectedObject, SelectedObject.PrimaryKey + ' = ' + 204 IntToStr(SelectedItemId)); 201 205 202 206 // Clear previous controls on panel … … 215 219 TabControl1.Tabs.Add(TReportColumn(Report.Columns[I]).Caption); 216 220 TabDataTypeList.Add(DataType); 217 TabObjectList.Add( MainForm.SelectedItem);221 TabObjectList.Add(SelectedItemId); 218 222 end else begin 219 223 NewControl := TLabel.Create(Panel1); … … 270 274 Selected: Boolean); 271 275 begin 272 if Assigned(ListView1.Selected) then273 SelectedItem := TReportLine(Report[ListView1.Selected.Index]).Id274 else SelectedItem := 0;275 276 276 ButtonDelete.Enabled := Assigned(ListView1.Selected); 277 277 ButtonView.Enabled := Assigned(ListView1.Selected);
Note:
See TracChangeset
for help on using the changeset viewer.