//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <
Vcl.Controls.hpp>
#include <
Vcl.StdCtrls.hpp>
#include <
Vcl.Forms.hpp>
#include <SHDocVw.hpp>
#include <
Vcl.OleCtrls.hpp>
#include "gmAPI.hpp"
#include "gmMap.hpp"
#include "gmOverlaysMarker.hpp"
#include "gmEvents.hpp"
#include "HTMLObjects.hpp"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: //
IDE-managed Components
TWebBrowser *WebBrowser1;
void __fastcall FormCreate(TObject *Sender);
private: // User declarations
TScript *Script;
void __fastcall InitMap(TObject *Sender);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall MarkerClick(TObject* Sender, Gmevents::TEvent Event);
};
//---------------------------------------------------------------------------
extern
PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//Unit1.cpp
//---------------------------------------------------------------------------
#include <
vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma
package(smart_init)
#pragma resource "*.dfm"
#pragma link "gmMap"
#pragma link "winInet.lib"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Script = new TScript(WebBrowser1);
Script->LoadAPIAsync(InitMap);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::InitMap(TObject *Sender)
{
int n;
TMarker *Marker;
TMarkerOptions *MarkerOptions;
TLatLng *MyLatLng;
TMap *MyMap;
TScript *Script = dynamic_cast<TScript*>(Sender);
TMapOptions *MyOptions = new TMapOptions;
MyOptions->Zoom = 4;
MyOptions->Center = Script->Google->Maps->LatLng(-25.363882,131.044922);
MyOptions->MapTypeID = Script->Google->Maps->MapTypeID->Roadmap;
MyMap = Script->Google->Maps->Map(MyOptions);
MarkerOptions = new TMarkerOptions;
MarkerOptions->Position = MyMap->GetCenter();
MarkerOptions->Map = MyMap;
MarkerOptions->Title = "Click to Zoom";
Marker = Script->Google->Maps->Marker(MarkerOptions);
Marker->OnClick = MarkerClick; //[BCC32 Error] Member function must be called or its address taken
delete MyOptions;
delete MarkerOptions;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::MarkerClick(TObject* Sender, Gmevents::TEvent Event)
{
if(Script->Google->Maps[0]->GetZoom==8) // Error :E2288 Pointer to structure required on left side of -> or ->*
{
}
}
//---------------------------------------------------------------------------