Ignore:
Timestamp:
Nov 24, 2011, 10:03:48 AM (13 years ago)
Author:
chronos
Message:
  • Modified: Item list is separated from MainForm as ItemListForm.
  • Modified: Now it is possible to open multiple forms for same operation as View, Edit, Add, List. Open forms are listed in main windows tab list.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UItemEdit.pas

    r30 r31  
    4646    procedure TabControl1Change(Sender: TObject);
    4747  private
    48     SelectedItem: Integer;
    4948    SubListObject: TChronisObject;
    5049    TabObjectList: TListInteger;
     
    5251    procedure LoadSubList;
    5352  public
     53    SelectedObject: TChronisObject;
     54    SelectedItemId: Integer;
    5455    Report: TReport;
    5556    procedure BuildControls;
     
    8889procedure TItemEditForm.ButtonAddClick(Sender: TObject);
    8990begin
    90   if Assigned(ListView1.Selected) then
    91     ItemAddForm.Show;
     91  ItemAddForm.Show;
    9292end;
    9393
     
    9999  with TReportLine(Report[Item.Index]) do begin
    100100    Item.Caption := Items[0];
     101    Item.Data := Pointer(Id);
    101102    for I := 1 to Items.Count - 1 do
    102103    if not TReportColumn(Report.Columns[I]).VirtualItem then
     
    127128    for I := 0 to Report.Columns.Count - 1 do
    128129    if not (TReportColumn(Report.Columns[I]).CustomType is TDataTypeRelationMany) then
    129     if TReportColumn(Report.Columns[I]).ColumnName <> MainForm.SelectedObject.PrimaryKey then begin
     130    if TReportColumn(Report.Columns[I]).ColumnName <> SelectedObject.PrimaryKey then begin
    130131      DataType := TReportColumn(Report.Columns[I]).CustomType;
    131132      Data.Add(TReportColumn(Report.Columns[I]).ColumnName,
    132133        DataType.GetControlValue(TWinControl(TReportColumn(Report.Columns[I]).Control)));
    133134    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);
    136137  finally
    137138    Data.Free;
    138139  end;
    139   if (MainForm.SelectedObject.Table = ObjectGroupTable) or
    140   (MainForm.SelectedObject.Table = ObjectTable) then
     140  if (SelectedObject.Table = ObjectGroupTable) or
     141  (SelectedObject.Table = ObjectTable) then
    141142    MainForm.LoadTree;
    142   MainForm.LoadItemList;
     143  //MainForm.LoadItemList;
    143144  Close;
    144145end;
     
    166167  TabDataTypeList.OwnsObjects := False;
    167168  TabControl1.Tabs.Clear;
     169  SelectedObject := TChronisObject.Create;
     170  SelectedObject.Base := Core.System;
    168171end;
    169172
     
    174177  TabObjectList.Free;
    175178  TabDataTypeList.Free;
     179  SelectedObject.Free;
    176180end;
    177181
     
    197201  LastTop := 8;
    198202  Column := 0;
    199   Report.Load(MainForm.SelectedObject, MainForm.SelectedObject.PrimaryKey + ' = ' +
    200     IntToStr(MainForm.SelectedItem));
     203  Report.Load(SelectedObject, SelectedObject.PrimaryKey + ' = ' +
     204    IntToStr(SelectedItemId));
    201205
    202206  // Clear previous controls on panel
     
    215219        TabControl1.Tabs.Add(TReportColumn(Report.Columns[I]).Caption);
    216220        TabDataTypeList.Add(DataType);
    217         TabObjectList.Add(MainForm.SelectedItem);
     221        TabObjectList.Add(SelectedItemId);
    218222      end else begin
    219223        NewControl := TLabel.Create(Panel1);
     
    270274  Selected: Boolean);
    271275begin
    272   if Assigned(ListView1.Selected) then
    273     SelectedItem := TReportLine(Report[ListView1.Selected.Index]).Id
    274     else SelectedItem := 0;
    275 
    276276  ButtonDelete.Enabled := Assigned(ListView1.Selected);
    277277  ButtonView.Enabled := Assigned(ListView1.Selected);
Note: See TracChangeset for help on using the changeset viewer.