Changeset 5 for trunk/Forms
- Timestamp:
- Jun 3, 2010, 6:00:52 PM (14 years ago)
- Location:
- trunk/Forms
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UItemEdit.lfm
r4 r5 5 5 Width = 558 6 6 ActiveControl = Panel1 7 Caption = ' ItemEditForm'7 Caption = 'Úprava položky' 8 8 ClientHeight = 429 9 9 ClientWidth = 558 -
trunk/Forms/UItemEdit.pas
r4 r5 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, 9 StdCtrls, Spin, EditBtn, USqlDatabase ;9 StdCtrls, Spin, EditBtn, USqlDatabase, MaskEdit; 10 10 11 11 type … … 128 128 TEdit(NewControl).Text := Values[0].Values[Properties[I].Values['ColumnName']]; 129 129 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']]; 130 151 end; 131 152 -
trunk/Forms/UMainForm.lfm
r4 r5 32 32 object TreeView1: TTreeView 33 33 Left = 8 34 Height = 4 1334 Height = 421 35 35 Top = 19 36 36 Width = 176 … … 110 110 top = 120 111 111 object AItemDelete: TAction 112 Category = ' Object'112 Category = 'Item' 113 113 Caption = 'Smazat' 114 114 end 115 115 object AItemAdd: TAction 116 Category = ' Object'116 Category = 'Item' 117 117 Caption = 'Přidat' 118 118 OnExecute = AItemAddExecute 119 119 end 120 120 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 121 153 Category = 'Object' 122 154 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 146 156 end 147 157 end … … 170 180 left = 72 171 181 top = 136 182 object MenuItem9: TMenuItem 183 Action = AObjectDelete 184 end 185 object MenuItem10: TMenuItem 186 Action = AObjectEdit 187 end 172 188 end 173 189 object PopupMenuObjectGroup: TPopupMenu -
trunk/Forms/UMainForm.pas
r4 r5 21 21 22 22 TMainForm = class(TForm) 23 AObjectEdit: TAction; 24 AObjectDelete: TAction; 23 25 AObjectGroupEdit: TAction; 24 26 AObjectGroupAddObject: TAction; … … 37 39 ListView1: TListView; 38 40 MenuItem1: TMenuItem; 41 MenuItem10: TMenuItem; 39 42 MenuItem2: TMenuItem; 40 43 MenuItem3: TMenuItem; … … 44 47 MenuItem7: TMenuItem; 45 48 MenuItem8: TMenuItem; 49 MenuItem9: TMenuItem; 46 50 Panel1: TPanel; 47 51 Panel2: TPanel; … … 54 58 procedure AItemEditExecute(Sender: TObject); 55 59 procedure AItemViewExecute(Sender: TObject); 60 procedure AObjectEditExecute(Sender: TObject); 56 61 procedure AObjectGroupAddGroupExecute(Sender: TObject); 62 procedure AObjectGroupEditExecute(Sender: TObject); 57 63 procedure ButtonAddClick(Sender: TObject); 58 64 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 84 90 85 91 uses 86 UItemView, UItemEdit ;92 UItemView, UItemEdit, UItemAdd; 87 93 88 94 {$R *.lfm} … … 153 159 end; 154 160 161 procedure TMainForm.AObjectEditExecute(Sender: TObject); 162 begin 163 if Assigned(TreeView1.Selected) then begin 164 SelectedObject := 9; 165 SelectedItem := Integer(TreeView1.Selected.Data); 166 ItemEditForm.Show; 167 end; 168 end; 169 155 170 procedure TMainForm.AObjectGroupAddGroupExecute(Sender: TObject); 156 171 begin … … 158 173 end; 159 174 175 procedure TMainForm.AObjectGroupEditExecute(Sender: TObject); 176 begin 177 if Assigned(TreeView1.Selected) then begin 178 SelectedObject := 8; 179 SelectedItem := Integer(TreeView1.Selected.Data); 180 ItemEditForm.Show; 181 end; 182 end; 183 160 184 procedure TMainForm.AItemEditExecute(Sender: TObject); 161 185 begin … … 165 189 procedure TMainForm.AItemAddExecute(Sender: TObject); 166 190 begin 167 191 ItemAddForm.Show; 168 192 end; 169 193 … … 206 230 procedure TMainForm.TreeView1Change(Sender: TObject; Node: TTreeNode); 207 231 begin 208 LoadItemList;209 232 AObjectGroupDelete.Enabled := Assigned(TreeView1.Selected); 210 233 AObjectGroupEdit.Enabled := Assigned(TreeView1.Selected); 211 234 if Assigned(TreeView1.Selected) then begin 212 if TreeView1.Selected.ImageIndex = 0 then 235 if TreeView1.Selected.ImageIndex = 0 then begin 213 236 TreeView1.PopupMenu := PopupMenuObjectGroup; 214 if TreeView1.Selected.ImageIndex = 1 then 237 ListView1.Visible := False; 238 end; 239 if TreeView1.Selected.ImageIndex = 1 then begin 215 240 TreeView1.PopupMenu := PopupMenuObject; 241 LoadItemList; 242 end; 216 243 end; 217 244 end; … … 237 264 NewNode.ImageIndex := 0; 238 265 NewNode.SelectedIndex := 0; 266 NewNode.Data := Pointer(StrToInt(DbRows[I].Values['Id'])); 239 267 ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `Group`=' + DbRows[I].Values['Id']); 240 268 for O := 0 to ObjectDbRows.Count - 1 do begin … … 263 291 begin 264 292 SelectedObject := 0; 265 if Assigned(TreeView1.Selected) 293 if Assigned(TreeView1.Selected)then 266 294 with ListView1, Items do begin 295 Visible := True; 267 296 Clear; 268 297 DbRows := Database.Query('SELECT * FROM `Object` WHERE `Id`=' + IntToStr(Integer(TreeView1.Selected.Data)));
Note:
See TracChangeset
for help on using the changeset viewer.