EmbeddedWB 2010 New Close Tab

D2 TEKNIK KOMPUTER (BSI PROGRAMMER)


   Sharing Browser menggunakan TEmbeddedWB 2010 pada Delphi 2010..!!


   Dalam project EmbeddedWB sudah berisikan demo - demo file browser beserta plugin - pluginnya , untuk itu saya mencoba melengkapinya lagi bersama Component Webbrowser yang pada umumnya masih kalah jauh dengan EmbeddedWB.

Mari kita Simak Coding berikut : 

unit Riset_NewTab;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, ComCtrls,OleCtrls, SHDocVw,
  cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
  dxSkinsDefaultPainters, dxSkinscxPCPainter, cxPCdxBarPopupMenu, cxPC,
  cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, StdCtrls,
  cxButtons, ToolWin;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    NewTab2: TMenuItem;
    cxPageControl1: TcxPageControl;
    ToolBar1: TToolBar;
    cxButton1: TcxButton;
    cxButton2: TcxButton;
    cxComboBox1: TcxComboBox;
    cxButton3: TcxButton;
    procedure NewTab2Click(Sender: TObject);
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure cxButton3Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    function GetActive: TWebbrowser;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  NewTab : TCxTabSheet;
  Url_Tab:TWebBrowser;

implementation

{$R *.dfm}

procedure TForm1.cxButton1Click(Sender: TObject);
begin
Url_Tab.GoBack;
end;

procedure TForm1.cxButton2Click(Sender: TObject);
begin
Url_Tab.GoForward;
end;

procedure TForm1.cxButton3Click(Sender: TObject);
begin
Url_Tab.Navigate(cxCombobox1.Text);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
Form1.NewTab2Click(Sender);
end;

procedure TForm1.NewTab2Click(Sender: TObject);
Var I:Integer;
URL:String;
begin
NewTab := TCxTabSheet.Create(CxPageControl1);
  with NewTab do
  begin
    PageControl := CxPageControl1;
    Parent := CxPageControl1;
    PageIndex := CxPageControl1.ActivePageIndex;
    NewTab.Caption:='FormRiset' + Inttostr(Random(1000));
    PageControl.ActivePageIndex:=NewTab.PageControl.Pages[PageControl.ActivePageIndex].PageIndex;
  end;
  Url_Tab:= TWebBrowser.Create(Newtab);
  TControl(Url_Tab).Parent:=NewTab;
    with Url_Tab do
       begin
          Url_Tab.Align:=AlClient;
       end;
CXPageControl1.ActivePage := NewTab;
URL_Tab.UPdate;
end;


function TForm1.GetActive: TWebbrowser;
var
  i: Integer;
begin
  Result := nil;
  if CxPageControl1.ActivePage <> nil then
    for i := 0 to CxPageControl1.ActivePage.ControlCount - 1 do
    begin
      if CxPageControl1.ActivePage.Controls[i] is TWebbrowser then
      begin
        Result := TWebbrowser(CxPageControl1.ActivePage.Controls[i]);
        Exit;
      end;
    end;
end;


end.



   Coding diatas merupakan kombinasi dari beberapa contoh project TEmbeddedWB 2010 yang kemudian disalin ulang ke Webbrowser...
maka dari itu , New Close Tab ini masih perlu diberikan racikan agar Browser bisa berjalan dengan baik..!!

Silahkan Download Project Sederhananya ||New Tab Close||

Posting Komentar

Please Select Embedded Mode To Show The Comment System.*

Lebih baru Lebih lama