Changeset 5 for trunk/Forms


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.
Location:
trunk/Forms
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UItemEdit.lfm

    r4 r5  
    55  Width = 558
    66  ActiveControl = Panel1
    7   Caption = 'ItemEditForm'
     7  Caption = 'Úprava položky'
    88  ClientHeight = 429
    99  ClientWidth = 558
  • trunk/Forms/UItemEdit.pas

    r4 r5  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    9   StdCtrls, Spin, EditBtn, USqlDatabase;
     9  StdCtrls, Spin, EditBtn, USqlDatabase, MaskEdit;
    1010
    1111type
     
    128128        TEdit(NewControl).Text := Values[0].Values[Properties[I].Values['ColumnName']];
    129129        TEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     130      end else
     131      if ValueType = Integer(vtPassword) then begin
     132        NewControl := TMaskEdit.Create(Panel1);
     133        NewControl.Parent := Panel1;
     134        NewControl.Top := LastTop;
     135        NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
     136        TMaskEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     137      end else
     138      if ValueType = Integer(vtBoolean) then begin
     139        NewControl := TCheckBox.Create(Panel1);
     140        NewControl.Parent := Panel1;
     141        NewControl.Top := LastTop;
     142        NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
     143        TCheckBox(NewControl).Checked := Boolean(StrToInt(Values[0].Values[Properties[I].Values['ColumnName']]));
     144      end else begin
     145        NewControl := TEdit.Create(Panel1);
     146        NewControl.Parent := Panel1;
     147        NewControl.Top := LastTop;
     148        NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
     149        TEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     150        TEdit(NewControl).Text := Values[0].Values[Properties[I].Values['ColumnName']];
    130151      end;
    131152
  • trunk/Forms/UMainForm.lfm

    r4 r5  
    3232    object TreeView1: TTreeView
    3333      Left = 8
    34       Height = 413
     34      Height = 421
    3535      Top = 19
    3636      Width = 176
     
    110110    top = 120
    111111    object AItemDelete: TAction
    112       Category = 'Object'
     112      Category = 'Item'
    113113      Caption = 'Smazat'
    114114    end
    115115    object AItemAdd: TAction
    116       Category = 'Object'
     116      Category = 'Item'
    117117      Caption = 'Přidat'
    118118      OnExecute = AItemAddExecute
    119119    end
    120120    object AItemEdit: TAction
     121      Category = 'Item'
     122      Caption = 'Upravit'
     123      OnExecute = AItemEditExecute
     124    end
     125    object AItemView: TAction
     126      Category = 'Item'
     127      Caption = 'Zobrazit'
     128      OnExecute = AItemViewExecute
     129    end
     130    object AObjectGroupDelete: TAction
     131      Category = 'ObjectGroup'
     132      Caption = 'Odebrat'
     133    end
     134    object AObjectGroupAddGroup: TAction
     135      Category = 'ObjectGroup'
     136      Caption = 'Přidat skupinu'
     137      OnExecute = AObjectGroupAddGroupExecute
     138    end
     139    object AObjectGroupAddObject: TAction
     140      Category = 'ObjectGroup'
     141      Caption = 'Přidat objekt'
     142    end
     143    object AObjectGroupEdit: TAction
     144      Category = 'ObjectGroup'
     145      Caption = 'Upravit'
     146      OnExecute = AObjectGroupEditExecute
     147    end
     148    object AObjectDelete: TAction
     149      Category = 'Object'
     150      Caption = 'Odstranit'
     151    end
     152    object AObjectEdit: TAction
    121153      Category = 'Object'
    122154      Caption = 'Upravit'
    123       OnExecute = AItemEditExecute
    124     end
    125     object AItemView: TAction
    126       Category = 'Object'
    127       Caption = 'Zobrazit'
    128       OnExecute = AItemViewExecute
    129     end
    130     object AObjectGroupDelete: TAction
    131       Category = 'ObjectGroup'
    132       Caption = 'Odebrat'
    133     end
    134     object AObjectGroupAddGroup: TAction
    135       Category = 'ObjectGroup'
    136       Caption = 'Přidat skupinu'
    137       OnExecute = AObjectGroupAddGroupExecute
    138     end
    139     object AObjectGroupAddObject: TAction
    140       Category = 'ObjectGroup'
    141       Caption = 'Přidat objekt'
    142     end
    143     object AObjectGroupEdit: TAction
    144       Category = 'ObjectGroup'
    145       Caption = 'Upravit'
     155      OnExecute = AObjectEditExecute
    146156    end
    147157  end
     
    170180    left = 72
    171181    top = 136
     182    object MenuItem9: TMenuItem
     183      Action = AObjectDelete
     184    end
     185    object MenuItem10: TMenuItem
     186      Action = AObjectEdit
     187    end
    172188  end
    173189  object PopupMenuObjectGroup: TPopupMenu
  • 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.