Public oForm
oForm = CreateObject("mapclass")
oForm.show
DEFINE CLASS mapclass AS form
Height = 573
Width = 741
DoCreate = .T.
Name = "form"
Caption = "Map form"
ADD OBJECT oweb AS olecontrol WITH ;
Top = 12, ;
Left = 12, ;
Height = 468, ;
Width = 720, ;
Name = "oWeb", ;
OleClass = "Shell.Explorer.2"
ADD OBJECT txtpostcode AS textbox WITH ;
Height = 25, ;
Left = 300, ;
Top = 492, ;
Width = 96, ;
Name = "txtPostCode"
ADD OBJECT cmdfind AS commandbutton WITH ;
Top = 492, ;
Left = 408, ;
Height = 27, ;
Width = 48, ;
Caption = "OK", ;
Name = "cmdFind"
ADD OBJECT cbowebsites AS combobox WITH ;
ColumnCount = 0, ;
ColumnWidths = "", ;
RowSourceType = 1, ;
RowSource = "Google Maps,Streetmap.co.uk,Multimap.co.uk", ;
FirstElement = 1, ;
Height = 24, ;
IncrementalSearch = .F., ;
Left = 72, ;
NumberOfElements = 0, ;
Style = 2, ;
Top = 492, ;
Width = 120, ;
BoundTo = .T., ;
Name = "cboWebSites"
ADD OBJECT label2 AS label WITH ;
FontBold = .T., ;
FontUnderline = .T., ;
Caption = "Web-site", ;
Height = 17, ;
Left = 12, ;
Top = 492, ;
Width = 53, ;
Name = "Label2"
ADD OBJECT label4 AS label WITH ;
FontBold = .T., ;
FontUnderline = .T., ;
Caption = "Site destination", ;
Height = 17, ;
Left = 204, ;
Top = 492, ;
Width = 96, ;
Name = "Label4"
PROCEDURE Load
Sys(2333,1)
EndProc
PROCEDURE cmdfind.Click
Local lcURL
Local lcStartPostCode
lcURL=""
* This is where the map starts from (used for google search only)
lcStartPostCode="RH13 5QH"
Do Case
Case Thisform.cboWebSites.ListIndex = 1 && Google
lcURL = "[URL unfurl="true"]http://maps.google.co.uk/maps?f=d&hl=en"[/URL]
lcURL = lcURL + "&saddr="+Chrtran(Alltrim(lcStartPostCode)," ","+")
lcURL = lcURL + "&daddr="+Chrtran(Alltrim(This.Parent.txtPostCode.Value)," ","+")
lcURL = lcURL + "&btnG=Search"
Case Thisform.cboWebSites.ListIndex = 2 && Streetmap
lcURL = "[URL unfurl="true"]http://www.streetmap.co.uk/streetmap.dll?postcode2map?"[/URL]
lcURL = lcURL + Chrtran(Alltrim(This.Parent.txtPostCode.Value)," ","+")
Case Thisform.cboWebSites.ListIndex = 3 && Multimap
lcURL = "[URL unfurl="true"]http://www.multimap.com/map/browse.cgi?client=public&search_result=&cidr_client=none&lang=&db=GB&keepicon=true&pc="+Chrtran(Alltrim(This.Parent.txtPostCode.Value),"[/URL] ","+")+"&advanced=true&addr2=&client=public&addr3=&overviewmap="
Otherwise
MessageBox ("Please select a web site.")
Return
EndCase
This.Parent.oWeb.Navigate(lcURL)
ENDPROC
ENDDEFINE