Changeset 6 for trunk/Forms
- Timestamp:
- Dec 25, 2010, 9:31:21 PM (14 years ago)
- Location:
- trunk/Forms
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UItemEdit.lfm
r5 r6 1 1 object ItemEditForm: TItemEditForm 2 Left = 2 872 Left = 295 3 3 Height = 429 4 Top = 17 54 Top = 174 5 5 Width = 558 6 6 ActiveControl = Panel1 -
trunk/Forms/UItemEdit.pas
r5 r6 46 46 procedure TItemEditForm.ButtonSaveClick(Sender: TObject); 47 47 begin 48 49 MainForm.LoadItemList; 48 50 Close; 49 51 end; -
trunk/Forms/UItemView.lfm
r3 r6 2 2 Left = 337 3 3 Height = 416 4 Top = 1 404 Top = 135 5 5 Width = 552 6 6 Caption = 'Zobrazení položky' -
trunk/Forms/UItemView.pas
r3 r6 86 86 87 87 for I := Panel1.ControlCount - 1 downto 0 do 88 Panel1.Controls[I]. Destroy;88 Panel1.Controls[I].Free; 89 89 90 90 // Load column names … … 114 114 Properties.Destroy; 115 115 end else ShowMessage('Objekt nenalezen'); 116 ObjectInfo. Destroy;116 ObjectInfo.Free; 117 117 end; 118 118 -
trunk/Forms/UMainForm.lfm
r5 r6 1 1 object MainForm: TMainForm 2 Left = 3 172 Left = 332 3 3 Height = 445 4 Top = 974 Top = 106 5 5 Width = 649 6 ActiveControl = Panel1 6 7 Caption = 'ChronIS' 7 ClientHeight = 4 458 ClientHeight = 422 8 9 ClientWidth = 649 10 Menu = MainMenu1 9 11 OnClose = FormClose 10 12 OnCreate = FormCreate … … 14 16 object Panel1: TPanel 15 17 Left = 0 16 Height = 4 4518 Height = 422 17 19 Top = 0 18 20 Width = 184 19 21 Align = alLeft 20 22 BevelOuter = bvNone 21 ClientHeight = 4 4523 ClientHeight = 422 22 24 ClientWidth = 184 23 25 TabOrder = 0 … … 26 28 Height = 14 27 29 Top = 4 28 Width = 4 730 Width = 46 29 31 Caption = 'Skupiny:' 30 32 ParentColor = False … … 32 34 object TreeView1: TTreeView 33 35 Left = 8 34 Height = 42136 Height = 398 35 37 Top = 19 36 38 Width = 176 … … 46 48 object Panel2: TPanel 47 49 Left = 189 48 Height = 4 4550 Height = 422 49 51 Top = 0 50 52 Width = 460 51 53 Align = alClient 52 54 BevelOuter = bvNone 53 ClientHeight = 4 4555 ClientHeight = 422 54 56 ClientWidth = 460 55 57 TabOrder = 1 … … 64 66 object ListView1: TListView 65 67 Left = 3 66 Height = 3 8968 Height = 366 67 69 Top = 19 68 70 Width = 450 69 71 Anchors = [akTop, akLeft, akRight, akBottom] 70 72 Columns = <> 71 ItemIndex = -172 73 PopupMenu = PopupMenuItem 73 74 ReadOnly = True … … 83 84 Left = 3 84 85 Height = 25 85 Top = 41686 Top = 393 86 87 Width = 75 87 88 Action = AItemAdd … … 92 93 Left = 83 93 94 Height = 25 94 Top = 41695 Top = 393 95 96 Width = 75 96 97 Action = AItemDelete … … 101 102 object Splitter1: TSplitter 102 103 Left = 184 103 Height = 4 45104 Height = 422 104 105 Top = 0 105 106 Width = 5 … … 154 155 Caption = 'Upravit' 155 156 OnExecute = AObjectEditExecute 157 end 158 object AExit: TAction 159 Caption = 'Exit' 160 OnExecute = AExitExecute 161 end 162 object AToggleFullscreen: TAction 163 Caption = 'Fullscreen mode F11' 164 OnExecute = AToggleFullscreenExecute 165 ShortCut = 122 156 166 end 157 167 end … … 174 184 object MenuItem2: TMenuItem 175 185 Action = AItemAdd 186 OnClick = AItemAddExecute 176 187 end 177 188 end … … 185 196 object MenuItem10: TMenuItem 186 197 Action = AObjectEdit 198 OnClick = AObjectEditExecute 187 199 end 188 200 end … … 193 205 object MenuItem5: TMenuItem 194 206 Action = AObjectGroupAddGroup 207 OnClick = AObjectGroupAddGroupExecute 195 208 end 196 209 object MenuItem7: TMenuItem … … 199 212 object MenuItem8: TMenuItem 200 213 Action = AObjectGroupEdit 214 OnClick = AObjectGroupEditExecute 201 215 end 202 216 object MenuItem6: TMenuItem … … 275 289 } 276 290 end 291 object MainMenu1: TMainMenu 292 left = 456 293 top = 120 294 object MenuItem13: TMenuItem 295 Caption = 'Server' 296 object MenuItem14: TMenuItem 297 Action = AExit 298 end 299 end 300 object MenuItem11: TMenuItem 301 Caption = 'View' 302 object MenuItem15: TMenuItem 303 Action = AToggleFullscreen 304 end 305 end 306 object MenuItem12: TMenuItem 307 Caption = 'Help' 308 end 309 end 277 310 end -
trunk/Forms/UMainForm.pas
r5 r6 21 21 22 22 TMainForm = class(TForm) 23 AToggleFullscreen: TAction; 24 AExit: TAction; 23 25 AObjectEdit: TAction; 24 26 AObjectDelete: TAction; … … 38 40 Label2: TLabel; 39 41 ListView1: TListView; 42 MainMenu1: TMainMenu; 40 43 MenuItem1: TMenuItem; 41 44 MenuItem10: TMenuItem; 45 MenuItem11: TMenuItem; 46 MenuItem12: TMenuItem; 47 MenuItem13: TMenuItem; 48 MenuItem14: TMenuItem; 49 MenuItem15: TMenuItem; 42 50 MenuItem2: TMenuItem; 43 51 MenuItem3: TMenuItem; … … 55 63 Splitter1: TSplitter; 56 64 TreeView1: TTreeView; 65 procedure AExitExecute(Sender: TObject); 57 66 procedure AItemAddExecute(Sender: TObject); 58 67 procedure AItemEditExecute(Sender: TObject); … … 61 70 procedure AObjectGroupAddGroupExecute(Sender: TObject); 62 71 procedure AObjectGroupEditExecute(Sender: TObject); 72 procedure AToggleFullscreenExecute(Sender: TObject); 63 73 procedure ButtonAddClick(Sender: TObject); 64 74 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 73 83 procedure TreeView1Change(Sender: TObject; Node: TTreeNode); 74 84 private 85 OriginalBounds: TRect; 86 OriginalWindowState: TWindowState; 87 ScreenBounds: TRect; 75 88 procedure LoadConfiguration; 76 89 public … … 103 116 I3: Integer; 104 117 begin 105 if FileExists(ConfigFileName) then begin118 if FileExists(ConfigFileName) then try 106 119 ReadXMLFile(Config, ConfigFileName); 107 120 for I1 := 0 to Config.ChildNodes.Count - 1 do … … 124 137 end; 125 138 end; 126 Config.Destroy; 139 finally 140 Config.Free; 127 141 end; 128 142 end; … … 139 153 procedure TMainForm.FormDestroy(Sender: TObject); 140 154 begin 141 TreeState. Destroy;142 Database. Destroy;143 PersistentForm. Destroy;155 TreeState.Free; 156 Database.Free; 157 PersistentForm.Free; 144 158 end; 145 159 … … 182 196 end; 183 197 198 procedure TMainForm.AToggleFullscreenExecute(Sender: TObject); 199 begin 200 if BorderStyle <> bsNone then begin 201 // To full screen 202 OriginalWindowState := WindowState; 203 OriginalBounds := BoundsRect; 204 205 BorderStyle := bsNone; 206 ScreenBounds := Screen.MonitorFromWindow(Handle).BoundsRect; 207 with ScreenBounds do 208 SetBounds(Left, Top, Right - Left, Bottom - Top) ; 209 end else begin 210 // From full screen 211 {$IFDEF MSWINDOWS} 212 BorderStyle := bsSizeable; 213 {$ENDIF} 214 if OriginalWindowState = wsMaximized then 215 WindowState := wsMaximized 216 else 217 with OriginalBounds do 218 SetBounds(Left, Top, Right - Left, Bottom - Top) ; 219 {$IFDEF LINUX} 220 BorderStyle := bsSizeable; 221 {$ENDIF} 222 end; 223 end; 224 184 225 procedure TMainForm.AItemEditExecute(Sender: TObject); 185 226 begin … … 190 231 begin 191 232 ItemAddForm.Show; 233 end; 234 235 procedure TMainForm.AExitExecute(Sender: TObject); 236 begin 237 Close; 192 238 end; 193 239 … … 259 305 TopItem.ImageIndex := 0; 260 306 TopItem.SelectedIndex := 0; 261 DbRows := Database.Query('SELECT * FROM `ObjectGroup`'); 262 for I := 0 to DbRows.Count - 1 do begin 263 NewNode := AddChild(TopItem, DbRows[I].Values['Name']); 264 NewNode.ImageIndex := 0; 265 NewNode.SelectedIndex := 0; 266 NewNode.Data := Pointer(StrToInt(DbRows[I].Values['Id'])); 267 ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `Group`=' + DbRows[I].Values['Id']); 268 for O := 0 to ObjectDbRows.Count - 1 do begin 269 NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']); 270 NewObjectNode.Data := Pointer(StrToInt(ObjectDbRows[O].Values['Id'])); 271 NewObjectNode.ImageIndex := 1; 272 NewObjectNode.SelectedIndex := 1; 273 end; 274 ObjectDbRows.Destroy; 275 end; 276 TopItem.Expand(True); 277 DbRows.Destroy; 307 try 308 DbRows := Database.Query('SELECT * FROM `ObjectGroup`'); 309 for I := 0 to DbRows.Count - 1 do begin 310 NewNode := AddChild(TopItem, DbRows[I].Values['Name']); 311 NewNode.ImageIndex := 0; 312 NewNode.SelectedIndex := 0; 313 NewNode.Data := Pointer(StrToInt(DbRows[I].Values['Id'])); 314 try 315 ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `Group`=' + DbRows[I].Values['Id']); 316 for O := 0 to ObjectDbRows.Count - 1 do begin 317 NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']); 318 NewObjectNode.Data := Pointer(StrToInt(ObjectDbRows[O].Values['Id'])); 319 NewObjectNode.ImageIndex := 1; 320 NewObjectNode.SelectedIndex := 1; 321 end; 322 finally 323 ObjectDbRows.Free; 324 end; 325 end; 326 TopItem.Expand(True); 327 finally 328 DbRows.Free; 329 end; 278 330 TreeState.LoadTree(TreeView1); 279 331 end; … … 295 347 Visible := True; 296 348 Clear; 349 try 297 350 DbRows := Database.Query('SELECT * FROM `Object` WHERE `Id`=' + IntToStr(Integer(TreeView1.Selected.Data))); 298 351 if DbRows.Count = 1 then begin … … 300 353 301 354 // Load column names 302 Properties := Database.Query('SELECT * FROM `Property` WHERE `Object`=' + 303 DbRows[0].Values['Id']); 304 Columns.Clear; 305 NewColumn := Columns.Add; 306 NewColumn.Caption := 'Id'; 307 for I := 0 to Properties.Count - 1 do begin 355 try 356 Properties := Database.Query('SELECT * FROM `Property` WHERE `Object`=' + 357 DbRows[0].Values['Id']); 358 Columns.Clear; 308 359 NewColumn := Columns.Add; 309 NewColumn.Caption := Properties[I].Values['Name']; 360 NewColumn.Caption := 'Id'; 361 for I := 0 to Properties.Count - 1 do begin 362 NewColumn := Columns.Add; 363 NewColumn.Caption := Properties[I].Values['Name']; 364 end; 365 finally 366 Properties.Free; 310 367 end; 311 368 … … 313 370 314 371 // Load items 372 try 315 373 Values := Database.Query('SELECT * FROM `' + DbRows[0].Values['Schema'] + '`.`' + 316 374 DbRows[0].Values['Table'] + '`'); … … 323 381 end; 324 382 end; 325 Values.Destroy; 326 Properties.Destroy; 327 end; 328 DbRows.Destroy; 383 finally 384 Values.Free; 385 end; 386 end; 387 finally 388 DbRows.Free; 389 end; 329 390 end; 330 391 end;
Note:
See TracChangeset
for help on using the changeset viewer.