gmlib google maps infowindow错误

时间:2014-10-20 14:06:42

标签: google-maps delphi infowindow gmlib

我使用gmlib V1.4.0 for Delphi Embarcadero XE6。我可以创建一个标记并在谷歌地图上显示它们但是当我创建一个弹出窗口以获取更多信息时(我使用GMMarker.InfoWindow.HTMLContent =' test')然后我在刷新地图后收到一条错误消息。 / p>

如果我不打开InfoWindow并刷新地图,则不会出现以下错误。 (" Pagina inicial aun no cargada")

有什么问题?

如果我只做' BTN_CreateMarkerClick'然后' BTN_DoMapClick'他们会工作,但如果我打电话给BTN_CreateInfoWindow点击'在刷新地图之前我收到错误。

unit DlgGoogleMaps;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, GMMap, GMLinkedComponents,
  GMMarker, GMMarkerVCL, GMClasses, GMMapVCL, Vcl.OleCtrls, SHDocVw, GMConstants,
  Vcl.ExtCtrls, GMGeoCode, GMInfoWindow;

type
  TDlg_GoogleMaps = class(TForm)
    Pan_Bottom: TPanel;
    Web_Box: TWebBrowser;
    GMMap: TGMMap;
    GMMarker: TGMMarker;
    BTN_LoadMap: TButton;
    BTN_CreateMarker: TButton;
    BTN_CreateInfoWindow: TButton;
    BTN_DoMap: TButton;
    GMGeoCode: TGMGeoCode;
    GMInfoWindow: TGMInfoWindow;
    procedure BTN_LoadMapClick(Sender: TObject);
    procedure BTN_CreateMarkerClick(Sender: TObject);
    procedure BTN_CreateInfoWindowClick(Sender: TObject);
    procedure BTN_DoMapClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Dlg_GoogleMaps: TDlg_GoogleMaps;

implementation

{$R *.dfm}

procedure TDlg_GoogleMaps.FormCreate(Sender: TObject);
begin
  Web_Box.Silent := True;
end;

procedure TDlg_GoogleMaps.FormShow(Sender: TObject);
begin
  try
    GMMap.Active := True;
  except
    ShowMessage('Network Error!');
  end;
end;


procedure TDlg_GoogleMaps.BTN_LoadMapClick(Sender: TObject);
begin
  GMMap.DoMap;
end;


procedure TDlg_GoogleMaps.BTN_CreateMarkerClick(Sender: TObject);
var
  point : TMarker;
begin
  point := GMMarker.Add(48.213983, 16.371970, 'TEST');

  point.MarkerType                   := GMConstants.mtstyledmarker;
  point.StyledMarker.BackgroundColor := 16777215;
  point.StyledMarker.TextColor       := 33023;
  point.StyledMarker.StyledIcon      := GMConstants.siBubble;

  GMMap.DoMap;
end;


procedure TDlg_GoogleMaps.BTN_CreateInfoWindowClick(Sender: TObject);
begin
  GMMarker.Items[0].InfoWindow.HTMLContent := 'HELLO';
  GMMarker.Items[0].ShowInfoWinMouseOver   := False;
end;


procedure TDlg_GoogleMaps.BTN_DoMapClick(Sender: TObject);
begin
  // after you open the InfoWindow (PopUp) they will be an error on GMMap.DoMap!??  (<FDocLoaded> ist not activ???)
  // if you don't open the InfoWindow (restart) and the click here they will not be an error. ("Pagina inicial aun no cargada")
  GMMap.DoMap;
end;

end.

0 个答案:

没有答案