Changeset 36 for trunk/Forms/UMainForm.pas
- Timestamp:
- Mar 8, 2012, 7:51:16 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 5 5 chronis.exe 6 6 DebugLog.txt 7 chronis.lps
-
- Property svn:ignore
-
trunk/Forms/UMainForm.pas
r35 r36 9 9 StdCtrls, ActnList, Menus, ExtCtrls, USqlDatabase, DOM, XMLRead, XMLWrite, 10 10 UPersistentForm, UTreeState, SpecializedList, SpecializedDictionary, 11 URegistry, USystem ;11 URegistry, USystem, UItemList; 12 12 13 13 type … … 54 54 MenuItem8: TMenuItem; 55 55 MenuItem9: TMenuItem; 56 PageControl1: TPageControl; 57 Panel1: TPanel; 58 Panel2: TPanel; 56 PanelMenu: TPanel; 57 PanelData: TPanel; 59 58 PopupMenuObjectGroup: TPopupMenu; 60 59 PopupMenuObject: TPopupMenu; 61 60 PopupMenuItem: TPopupMenu; 62 61 Splitter1: TSplitter; 62 StatusBar1: TStatusBar; 63 63 TreeView1: TTreeView; 64 64 procedure AAboutExecute(Sender: TObject); … … 87 87 procedure SaveToRegistry; 88 88 public 89 MainPanelForm: TForm; 89 90 PersistentForm: TPersistentForm; 90 91 TreeState: TTreeState; 91 92 Report: TReport; 92 TabForms: TListObject; // TListObject<TForm>93 93 procedure UpdateInterface; 94 94 procedure LoadTree; 95 procedure AddTabForm(Form: TForm);95 procedure SetMainPanelForm(Form: TForm); 96 96 end; 97 97 … … 112 112 UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo, 113 113 UCore, UImportStructureForm, UAboutForm, ULoginProfileForm, UChronisClientDirect, 114 U ItemList, UChronisClient;114 UChronisClient; 115 115 116 116 {$R *.lfm} … … 124 124 RootKey := Core.RegistryRootKey; 125 125 OpenKey(Core.RegistryKey, True); 126 Panel 1.Width := ReadIntegerWithDefault('GroupTreeWidth', 200);126 PanelMenu.Width := ReadIntegerWithDefault('GroupTreeWidth', 200); 127 127 with Core.CoolTranslator1 do 128 128 Language := Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')); … … 138 138 RootKey := Core.RegistryRootKey; 139 139 OpenKey(Core.RegistryKey, True); 140 WriteInteger('GroupTreeWidth', Panel 1.Width);140 WriteInteger('GroupTreeWidth', PanelMenu.Width); 141 141 with Core.CoolTranslator1 do 142 142 WriteString('LanguageCode', Language.Code); … … 151 151 AConnect.Enabled := not Core.System.Database.Connected; 152 152 AImportStructure.Enabled := Core.System.Database.Connected; 153 if Assigned(MainPanelForm) then 154 Caption := MainPanelForm.Caption + ' - ' + ApplicationInfo.Name 155 else Caption := ApplicationInfo.Name; 156 if Assigned(Core.System.Client) then 157 with Core.System.Client do 158 StatusBar1.Panels[0].Text := User + '@' + Host + ':' + IntToStr(Port) + '/' + Schema; 153 159 end; 154 160 155 161 procedure TMainForm.FormCreate(Sender: TObject); 156 162 begin 157 TabForms := TListObject.Create;158 TabForms.OwnsObjects := False;159 163 TreeState := TTreeState.Create; 160 164 Report := TReport.Create; … … 169 173 TreeState.Free; 170 174 PersistentForm.Free; 171 TabForms.Free;172 175 end; 173 176 … … 204 207 procedure TMainForm.ASettingsExecute(Sender: TObject); 205 208 begin 206 SettingForm.ShowModal; 209 try 210 SettingForm := TSettingForm.Create(nil); 211 SettingForm.ShowModal; 212 finally 213 SettingForm.Free; 214 end; 207 215 end; 208 216 … … 311 319 if TreeView1.Selected.ImageIndex = 0 then begin 312 320 TreeView1.PopupMenu := PopupMenuObjectGroup; 313 Pa geControl1.Visible := False;321 PanelData.Visible := False; 314 322 end; 315 323 if TreeView1.Selected.ImageIndex = 1 then begin … … 327 335 NewItemListForm := TItemListForm.Create(Self); 328 336 NewItemListForm.SelectedObject.Load(Integer(TreeView1.Selected.Data)); 329 NewItemListForm.Caption := NewItemListForm. Caption + ' ' + NewItemListForm.SelectedObject.Name;330 AddTabForm(NewItemListForm);337 NewItemListForm.Caption := NewItemListForm.SelectedObject.Name; 338 SetMainPanelForm(NewItemListForm); 331 339 end; 332 340 end; … … 387 395 end; 388 396 389 procedure TMainForm.AddTabForm(Form: TForm); 390 var 391 NewTabSheet: TTabSheet; 392 begin 393 TabForms.Add(Form); 394 NewTabSheet := PageControl1.AddTabSheet; 395 NewTabSheet.DockSite := True; 396 NewTabSheet.UseDockManager := True; 397 NewTabSheet.Caption := Form.Caption; 398 PageControl1.TabIndex := PageControl1.PageCount - 1; 399 Form.DragKind := dkDock; 400 Form.DragMode := dmAutomatic; 401 Form.ManualDock(NewTabSheet); 402 Form.Show; 403 404 // Workaround for not showing content of first tab after docking 405 NewTabSheet.Visible := False; 406 NewTabSheet.Visible := True; 397 procedure TMainForm.SetMainPanelForm(Form: TForm); 398 begin 399 MainPanelForm.Free; 400 MainPanelForm := Form; 401 MainPanelForm.ManualDock(PanelData, nil, alClient); 402 MainPanelForm.Align := alClient; 403 MainPanelForm.Show; 404 UpdateInterface; 407 405 end; 408 406
Note:
See TracChangeset
for help on using the changeset viewer.