Changeset 41 for trunk/Forms


Ignore:
Timestamp:
Mar 9, 2012, 9:40:05 AM (13 years ago)
Author:
chronos
Message:
  • Fixed: Memory leak in TReportColumn.
  • Modified: Main item list is created once on application start instead on every tree item mouse doubleclick.
Location:
trunk/Forms
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UItemAdd.lfm

    r22 r41  
    1111  OnCreate = FormCreate
    1212  OnDestroy = FormDestroy
     13  OnKeyPress = FormKeyPress
    1314  OnShow = FormShow
    1415  LCLVersion = '0.9.31'
  • trunk/Forms/UItemAdd.pas

    r40 r41  
    2323    procedure FormCreate(Sender: TObject);
    2424    procedure FormDestroy(Sender: TObject);
     25    procedure FormKeyPress(Sender: TObject; var Key: char);
    2526    procedure FormShow(Sender: TObject);
    2627  private
     
    100101end;
    101102
     103procedure TItemAddForm.FormKeyPress(Sender: TObject; var Key: char);
     104begin
     105  if Key = #27 then Close;
     106end;
     107
    102108procedure TItemAddForm.FormShow(Sender: TObject);
    103109begin
     
    124130    Panel1.Controls[I].Free;
    125131
    126   //Report.Load(SelectedObject, SelectedObject.PrimaryKey + ' = ' +
    127   //  IntToStr(SelectedItemId));
     132  Report.Load(SelectedObject, SelectedObject.PrimaryKey + ' = ' +
     133    IntToStr(SelectedItemId));
    128134
    129135  // Load column names
  • trunk/Forms/UItemList.pas

    r40 r41  
    4242  private
    4343    Report: TReport;
    44     procedure LoadItemList;
    4544  public
    4645    SelectedObject: TChronisObject;
    4746    SelectedItem: Integer;
     47    procedure Reload;
    4848  end;
    4949
     
    6060{ TItemListForm }
    6161
    62 procedure TItemListForm.LoadItemList;
     62procedure TItemListForm.Reload;
    6363var
    6464  NewColumn: TListColumn;
     
    110110procedure TItemListForm.FormShow(Sender: TObject);
    111111begin
    112   LoadItemList;
     112  Reload;
    113113end;
    114114
  • trunk/Forms/ULoginForm.lfm

    r40 r41  
    11object LoginForm: TLoginForm
    2   Left = 312
     2  Left = 288
    33  Height = 177
    4   Top = 186
     4  Top = 243
    55  Width = 451
    66  BorderIcons = [biSystemMenu]
  • trunk/Forms/UMainForm.pas

    r40 r41  
    8686    procedure LoadFromRegistry;
    8787    procedure SaveToRegistry;
     88    procedure InitDock;
    8889  public
    89     MainPanelForm: TForm;
     90    MainPanelForm: TItemListForm;
    9091    PersistentForm: TPersistentForm;
    9192    TreeState: TTreeState;
     
    9394    procedure UpdateInterface;
    9495    procedure LoadTree;
    95     procedure SetMainPanelForm(Form: TForm);
    9696  end;
    9797
     
    146146end;
    147147
     148procedure TMainForm.InitDock;
     149begin
     150  MainPanelForm := TItemListForm.Create(Self);
     151  MainPanelForm.ManualDock(PanelData, nil, alClient);
     152  MainPanelForm.Align := alClient;
     153end;
     154
    148155procedure TMainForm.UpdateInterface;
    149156begin
     
    154161    Caption := MainPanelForm.Caption + ' - ' + ApplicationInfo.Name
    155162    else Caption :=  ApplicationInfo.Name;
     163  Application.Title := Caption;
    156164  if Assigned(Core.System.Client) then
    157165  with Core.System.Client do
     
    170178procedure TMainForm.FormDestroy(Sender: TObject);
    171179begin
     180  FreeAndNil(MainPanelForm);
    172181  FreeAndNil(Report);
    173182  FreeAndNil(TreeState);
     
    306315  PersistentForm.Load(Self);
    307316  LoadFromRegistry;
     317  InitDock;
    308318  AConnect.Execute;
    309319end;
     
    341351
    342352procedure TMainForm.TreeView1DblClick(Sender: TObject);
    343 var
    344   NewItemListForm: TItemListForm;
    345353begin
    346354  if Assigned(TreeView1.Selected) then begin
    347     NewItemListForm := TItemListForm.Create(Self);
    348     NewItemListForm.SelectedObject.Load(Integer(TreeView1.Selected.Data));
    349     NewItemListForm.Caption := NewItemListForm.SelectedObject.Name;
    350     SetMainPanelForm(NewItemListForm);
     355    MainPanelForm.SelectedObject.Load(Integer(TreeView1.Selected.Data));
     356    MainPanelForm.Caption := MainPanelForm.SelectedObject.Name;
     357    MainPanelForm.Show;
     358    MainPanelForm.Reload;
     359    UpdateInterface;
    351360  end;
    352361end;
     
    407416end;
    408417
    409 procedure TMainForm.SetMainPanelForm(Form: TForm);
    410 begin
    411   MainPanelForm.Free;
    412   MainPanelForm := Form;
    413   MainPanelForm.ManualDock(PanelData, nil, alClient);
    414   MainPanelForm.Align := alClient;
    415   MainPanelForm.Show;
    416   UpdateInterface;
    417 end;
    418 
    419418end.
    420419
Note: See TracChangeset for help on using the changeset viewer.