Ignore:
Timestamp:
Jun 3, 2010, 6:00:52 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Formulář pro vkládání položek.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UMainForm.pas

    r4 r5  
    2121
    2222  TMainForm = class(TForm)
     23    AObjectEdit: TAction;
     24    AObjectDelete: TAction;
    2325    AObjectGroupEdit: TAction;
    2426    AObjectGroupAddObject: TAction;
     
    3739    ListView1: TListView;
    3840    MenuItem1: TMenuItem;
     41    MenuItem10: TMenuItem;
    3942    MenuItem2: TMenuItem;
    4043    MenuItem3: TMenuItem;
     
    4447    MenuItem7: TMenuItem;
    4548    MenuItem8: TMenuItem;
     49    MenuItem9: TMenuItem;
    4650    Panel1: TPanel;
    4751    Panel2: TPanel;
     
    5458    procedure AItemEditExecute(Sender: TObject);
    5559    procedure AItemViewExecute(Sender: TObject);
     60    procedure AObjectEditExecute(Sender: TObject);
    5661    procedure AObjectGroupAddGroupExecute(Sender: TObject);
     62    procedure AObjectGroupEditExecute(Sender: TObject);
    5763    procedure ButtonAddClick(Sender: TObject);
    5864    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    8490
    8591uses
    86   UItemView, UItemEdit;
     92  UItemView, UItemEdit, UItemAdd;
    8793
    8894{$R *.lfm}
     
    153159end;
    154160
     161procedure TMainForm.AObjectEditExecute(Sender: TObject);
     162begin
     163  if Assigned(TreeView1.Selected) then begin
     164    SelectedObject := 9;
     165    SelectedItem := Integer(TreeView1.Selected.Data);
     166    ItemEditForm.Show;
     167  end;
     168end;
     169
    155170procedure TMainForm.AObjectGroupAddGroupExecute(Sender: TObject);
    156171begin
     
    158173end;
    159174
     175procedure TMainForm.AObjectGroupEditExecute(Sender: TObject);
     176begin
     177  if Assigned(TreeView1.Selected) then begin
     178    SelectedObject := 8;
     179    SelectedItem := Integer(TreeView1.Selected.Data);
     180    ItemEditForm.Show;
     181  end;
     182end;
     183
    160184procedure TMainForm.AItemEditExecute(Sender: TObject);
    161185begin
     
    165189procedure TMainForm.AItemAddExecute(Sender: TObject);
    166190begin
    167 
     191  ItemAddForm.Show;
    168192end;
    169193
     
    206230procedure TMainForm.TreeView1Change(Sender: TObject; Node: TTreeNode);
    207231begin
    208   LoadItemList;
    209232  AObjectGroupDelete.Enabled := Assigned(TreeView1.Selected);
    210233  AObjectGroupEdit.Enabled := Assigned(TreeView1.Selected);
    211234  if Assigned(TreeView1.Selected) then begin
    212     if TreeView1.Selected.ImageIndex = 0 then
     235    if TreeView1.Selected.ImageIndex = 0 then begin
    213236      TreeView1.PopupMenu := PopupMenuObjectGroup;
    214     if TreeView1.Selected.ImageIndex = 1 then
     237      ListView1.Visible := False;
     238    end;
     239    if TreeView1.Selected.ImageIndex = 1 then begin
    215240      TreeView1.PopupMenu := PopupMenuObject;
     241      LoadItemList;
     242    end;
    216243  end;
    217244end;
     
    237264      NewNode.ImageIndex := 0;
    238265      NewNode.SelectedIndex := 0;
     266      NewNode.Data := Pointer(StrToInt(DbRows[I].Values['Id']));
    239267      ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `Group`=' + DbRows[I].Values['Id']);
    240268      for O := 0 to ObjectDbRows.Count - 1 do begin
     
    263291begin
    264292  SelectedObject := 0;
    265   if Assigned(TreeView1.Selected) then
     293  if Assigned(TreeView1.Selected)then
    266294  with ListView1, Items do begin
     295    Visible := True;
    267296    Clear;
    268297    DbRows := Database.Query('SELECT * FROM `Object` WHERE `Id`=' + IntToStr(Integer(TreeView1.Selected.Data)));
Note: See TracChangeset for help on using the changeset viewer.