![]() |
New TabSheet with TWebbrowser and TToolBar
Hello, how can i make, that on the new opened TabSheet would be TWebbrowser and TToolBar(with all Buttons, ...)? Here is my code but with error:
Delphi-Quellcode:
This code opens new TabSheet with TWebbrowser and TToolBar but with error. Also in previous TabSheet this TToolBar lost...
procedure TForm1.NewTab;
var Tab: TTabSheet; Browser: TWebBrowser; begin Tab:= TTabSheet.Create(PageControl1); Tab.PageControl := PageControl1; Tab.Parent := PageControl1; Tab.PageIndex := PageControl1.ActivePageIndex + 1; ToolBar2.Create(Tab); TControl(ToolBar2).Parent := Tab; ToolBar2.Align := alTop; Browser:= TWebBrowser.Create(Tab); TControl(Browser).Parent := Tab; Browser.Align := alClient; Browser.Silent := True; Browser.Visible := True; PageControl1.ActivePage := Tab; Browser.OnStatusTextChange := WebBrowser1StatusTextChange; Browser.OnTitleChange := WebBrowser1TitleChange; Browser.OnNewWindow2 := WebBrowser1NewWindow2; Browser.OnCommandStateChange := WebBrowser1CommandStateChange; ImageButton1.Enabled := False; ImageButton2.Enabled := False; Browser.Navigate('about:blank'); end; Please help me :roll: |
Re: New TabSheet with TWebbrowser and TToolBar
Here is an error:
Delphi-Quellcode:
correct it must be:
ToolBar2.Create(Tab);
Delphi-Quellcode:
ToolBar2:=TToolBar.Create(Tab);
|
Re: New TabSheet with TWebbrowser and TToolBar
While ToolBar2.Create() effectively reinitializes the ToolBar you already employ on your first tabsheet, ToolBar2 := TToolBar.Create() overwrites the global variable ToolBar2 you might use elsewhere to refer to the prevous instance. Think twice - normally only one toolbar is assigned to a form with a pagecontrol. Position is preferably on top of the form, right below the menu. If the user changes the active tabsheet, you query the state of the command buttons from the then active browser control.
marabu |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz