Hope this gives you some idea
Public ofrmgooglemap
ofrmgooglemap=Newobject("frmgooglemap")
ofrmgooglemap.Show
Return
**************************************************
*-- Form: frmgooglemap (xxxxxxxxxxxxxxxx)
*-- ParentClass: frm (xxxxxxxxxxxxxxxxxxxxxxxxx)
*-- BaseClass: form
*-- Time Stamp: 09/18/09 02:57:09 PM
*
Define Class frmgooglemap As frm
Top = -3
Left = 1
Height = 600
Width = 800
DoCreate = .T.
Caption = "Google Map"
Name = "FRMGOOGLEMAP"
Add Object BrowseR As OleControl With ;
Top = 0, ;
Left = 0, ;
Height = 600, ;
Width = 800, ;
Anchor = 15, ;
Name = "browser"
Procedure Init
Lparameters lnFk_employee, lnFk_client, lcGoogleorMapquest, lnFk_office
** i use a method call to get a cursor for the employee and client called myEmployeeInfo and myClientInfo
If Empty(lcGoogleorMapquest)
lcGoogleorMapquest = ''
Endif
Do Case
Case !Empty(lnFk_employee) And !Empty(lnFk_client) And Empty(lnFk_office) &&&& directions employee to client
&&& get address string for map
lcEmployee_address_string = &&& code to set up address string for employee
lcClient_address_string = &&& method call to set up client address string
*** assume no address for employee
lcAddressEmployee = ''
If !Empty(Alltrim(myEmployeeInfo.add1))
lcAddressEmployee = lcAddressEmployee +Alltrim(myEmployeeInfo.add1)
Endif
If !Empty(Alltrim(myEmployeeInfo.town))
lcAddressEmployee = lcAddressEmployee + '+'+Alltrim(myEmployeeInfo.town)
Endif
If !Empty(Alltrim(myEmployeeInfo.state))
lcAddressEmployee = lcAddressEmployee + '+'+Alltrim(myEmployeeInfo.state)
Endif
If !Empty(Alltrim(myEmployeeInfo.zip))
lcAddressEmployee = lcAddressEmployee + '+'+Alltrim(myEmployeeInfo.zip)
Endif
lcEmployeeName = 'EMPLOYEE: '+Alltrim(myEmployeeInfo.name_full)
lcAddressClient = ''
If !Empty(Alltrim(myClientInfo.add1))
lcAddressClient = lcAddressClient+Alltrim(myClientInfo.add1)
Endif
If !Empty(Alltrim(myClientInfo.town))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.town)
Endif
If !Empty(Alltrim(myClientInfo.state))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.state)
Endif
If !Empty(Alltrim(myClientInfo.zip))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.zip)
Endif
lcClientName = 'CLIENT: '+Alltrim(myClientInfo.name_full)
This.Caption = 'Directions from '+lcEmployeeName+' to '+lcClientName
This.BrowseR.Navigate('
lcAddressEmployee+;
'('+lcEmployeeName+')'+;
'&daddr='+lcAddressClient+;
'('+lcClientName+')')
Case Empty(lnFk_employee) And !Empty(lnFk_client) And Empty(lnFk_office) &&& map client
lcClient_address_string = &&& your code here
lcAddressClient = ''
If !Empty(Alltrim(myClientInfo.add1))
lcAddressClient = lcAddressClient+Alltrim(myClientInfo.add1)
Endif
If !Empty(Alltrim(myClientInfo.town))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.town)
Endif
If !Empty(Alltrim(myClientInfo.state))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.state)
Endif
If !Empty(Alltrim(myClientInfo.zip))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.zip)
Endif
lcClientName = 'CLIENT: '+Alltrim(myClientInfo.name_full)
This.Caption = 'Map for '+lcClientName
This.BrowseR.Navigate('
lcAddressClient+'('+lcClientName+')')
Case !Empty(lnFk_employee) And Empty(lnFk_client) And Empty(lnFk_office) &&& map employee
lcEmployee_address_string = && your code here
lcAddressEmployee = ''
If !Empty(Alltrim(myEmployeeInfo.add1))
lcAddressEmployee = lcAddressEmployee+Alltrim(myEmployeeInfo.add1)
Endif
If !Empty(Alltrim(myEmployeeInfo.town))
lcAddressEmployee = lcAddressEmployee+ '+'+Alltrim(myEmployeeInfo.town)
Endif
If !Empty(Alltrim(myEmployeeInfo.state))
lcAddressEmployee = lcAddressEmployee+ '+'+Alltrim(myEmployeeInfo.state)
Endif
If !Empty(Alltrim(myEmployeeInfo.zip))
lcAddressEmployee = lcAddressEmployee+ '+'+Alltrim(myEmployeeInfo.zip)
Endif
lcEmployeeName = 'EMPLOYEE: '+Alltrim(myEmployeeInfo.name_full)
This.Caption = 'Map for '+lcEmployeeName
This.BrowseR.Navigate('
lcAddressEmployee+'('+lcEmployeeName+')')
Case Empty(lnFk_employee) And !Empty(lnFk_client) And !Empty(lnFk_office) &&& directions client to office
&&& get address string for map
lcClient_address_string = && your code
lcAddressClient = ''
If !Empty(Alltrim(myClientInfo.add1))
lcAddressClient = lcAddressClient+Alltrim(myClientInfo.add1)
Endif
If !Empty(Alltrim(myClientInfo.town))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.town)
Endif
If !Empty(Alltrim(myClientInfo.state))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.state)
Endif
If !Empty(Alltrim(myClientInfo.zip))
lcAddressClient = lcAddressClient+ '+'+Alltrim(myClientInfo.zip)
Endif
lcClientName = 'CLIENT: '+Alltrim(myClientInfo.name_full)
This.Caption = 'Directions from '+lcOfficeName+' to '+lcClientName
This.BrowseR.Navigate('
lcOfficeAddress+'('+lcOfficeName+')'+;
'&daddr='+lcAddressClient+'('+lcClientName+')')
Case !Empty(lnFk_employee) And Empty(lnFk_client) And !Empty(lnFk_office) &&& directions employee to office
lcEmployee_address_string = && your code
lcAddressEmployee = ''
If !Empty(Alltrim(myEmployeeInfo.add1))
lcAddressEmployee = lcAddressEmployee +Alltrim(myEmployeeInfo.add1)
Endif
If !Empty(Alltrim(myEmployeeInfo.town))
lcAddressEmployee = lcAddressEmployee + '+'+Alltrim(myEmployeeInfo.town)
Endif
If !Empty(Alltrim(myEmployeeInfo.state))
lcAddressEmployee = lcAddressEmployee + '+'+Alltrim(myEmployeeInfo.state)
Endif
If !Empty(Alltrim(myEmployeeInfo.zip))
lcAddressEmployee = lcAddressEmployee + '+'+Alltrim(myEmployeeInfo.zip)
Endif
lcEmployeeName = 'EMPLOYEE: '+Alltrim(myEmployeeInfo.name_full)
This.Caption = 'Directions to '+lcOfficeName+' to '+lcEmployeeName
This.BrowseR.Navigate('
'&daddr='+lcOfficeAddress+'('+lcOfficeName+')')
Endcase
Endproc
Enddefine
*
*-- EndDefine: frmgooglemap
**************************************************