Changeset 5 for trunk/Forms/UMainForm.pas
- Timestamp:
- Jun 3, 2010, 6:00:52 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.