Has anyone had any success getting StreetView to display in a TWebBrowser control?
I want to build a Url programmatically and have it display in a simple Delphi form.
Here's what I have so far for that form:
unit frmSView;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls;
type
TfrmStreetView = class(TForm)
browserStreetView: TWebBrowser;
txtAddress: TEdit;
procedure txtAddressExit(Sender: TObject);
procedure ShowSV(Lat: string; Lon: string);
private
// private declarations
public
// public declarations
end;
var
frmStreetView: TfrmStreetView;
implementation
{$R *.dfm}
procedure TfrmStreetView.ShowSV(Lat: string; Lon: string);
var
Addr: string;
Flags: OleVariant;
begin
Addr := 'http://maps.google.com/maps?q=&&layer=c&&cbll=' + Lat + ',' + Lon + '&&cbp=12,0,0,0,0&&output=svembed';
browserStreetView.Navigate(Addr, Flags, Flags, Flags, Flags);
txtAddress.Text := Addr;
ShowModal;
end;
procedure TfrmStreetView.txtAddressExit(Sender: TObject);
var
Flags: OleVariant;
begin
browserStreetView.Navigate(txtAddress.Text, Flags, Flags, Flags, Flags);
end;
end.
When the form shows:
I'm guessing that the Flash player is not loading.
Do you guys have any ideas?
Regards,
Simon
It's been a long time since I wrote anything with Delphi but if I remember correctly, the TWebBrowser control is the browser part of whatever version of Internet Explorer you have on your system. The "browser part" means the HTML renderer and the Javascript interpreter, but the complete program called Internet Explorer is more than that. It also has plugins, such as Flash, and some management logic to load those plugins when needed.
What I'd suggest is that instead of loading maps.google.com you could create a simple page with the V3 API which implements streetview without Flash, (pure Javascript). Try loading this page into your TWebBrowser control and then just drop the pegman somewhere nice: