gywlx Posted August 11, 2011 Share Posted August 11, 2011 procedure TMainAreaForm.NavTreeViewClick(Sender: TObject); var s, sn, strSheetName:string; uts:TUniTabSheet; I: Integer; begin s := NavTreeView.Selected.Text; if s='主界面' then sn := 'Main' else if s='考勤登记' then sn := 'WorkRecord' else if s='销售分析' then sn := 'SaleTotal' else if s='注销离开' then begin UniApplication.Terminate; exit; end else sn := 'Main'; strSheetName := sn+'Sheet'; for I := 0 to NavPage.PageCount - 1 do begin uts := NavPage.Pages[i]; if uts.Name=strSheetName then begin NavPage.ActivePage := uts; NavPageChange(NavPage); exit; end; end; uts := TUniTabSheet.Create( NavPage ); uts.Caption := s; uts.Name := strSheetName; uts.PageControl := NavPage; NavPage.ActivePage := uts; NavPageChange(NavPage); InsertFrame(NavPage.ActivePage, sn); end; procedure TMainAreaForm.btnCloseSheetClick(Sender: TObject); var I: Integer; begin NavPage.ActivePage.Free; if NavPage.ActivePage=MainSheet then btnDelSheet.Visible := False; for I := 0 to NavTreeView.Items.Count - 1 do if NavTreeView.Items.Item[i].Text=NavPage.ActivePage.Caption then begin NavTreeView.Items.Item[i].Selected := True; Break; end; end; Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 11, 2011 Administrators Share Posted August 11, 2011 It is not clear from your code. You need to send a test case which reproduces the problem. Link to comment Share on other sites More sharing options...
stlcours Posted August 11, 2011 Share Posted August 11, 2011 Maybe problem is in "InsertFrame(NavPage.ActivePage, sn);"??? You can sell me your project, and I will test for you. stlcours@hotmail.com Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now