Power Builder - PW no reconoce el objeto document del Microsoft Web Brownser

   
Vista:

PW no reconoce el objeto document del Microsoft Web Brownser

Publicado por Supo (1 intervención) el 17/12/2012 14:30:19
Tengo el siguiente problema: Utilizo el Microsoft Web Brownser para mostrar direcciones de clientes en los mapas de google. Funciona perfectamente en un proyecto cliente servidor, pero si lo compilo como aplicacion web... ¡Me desconoce el objeto "document"!

Al ejecutarlo me arroja el error "object null"

De hecho, ya trabajando cliente-servidor al escribir: "ole_navegador.Object." al oprimir el operador punto deberia mostrarme el objeto document.... cosa que no hace.

Pongo el codigo completo, que, repito, funciona perfectamente como aplicacion cliente-servidor:


string ls_html, ls_direccion, ls_html1, ls_calle, ls_ciudad, ls_provincia, ls_pais
ls_html = " "
ls_html1 = " "

ls_html = " <!DOCTYPE html> "
ls_html = ls_html + " <html> "
ls_html = ls_html + " <head> "
ls_html = ls_html + " <meta name='" + "viewport" + "' content='initial-scale=1.0, user-scalable=no' /> "
ls_html = ls_html + " <style type='text/css'> "
ls_html = ls_html + " html { height: 100% } "
ls_html = ls_html + " body { height: 100%; margin: 0; padding: 0 } "
ls_html = ls_html + " #map_canvas { height: 100% } "
ls_html = ls_html + " </style> "
ls_html = ls_html + " <script type='text/javascript' src='https://maps.google.com/maps/api/js?sensor=true'></script> "
ls_html = ls_html + " <script type='text/javascript'> "
ls_html = ls_html + " var geocoder; "
ls_html = ls_html + " var map; "
ls_html = ls_html + " function initialize() { "
ls_html = ls_html + " geocoder = new google.maps.Geocoder(); "
ls_html = ls_html + " var latlng = new google.maps.LatLng(-34.397, 150.644); "
ls_html = ls_html + " var myOptions = { "
ls_html = ls_html + " zoom: 17, "
ls_html = ls_html + " center: latlng, "
ls_html = ls_html + " mapTypeId: google.maps.MapTypeId.ROADMAP, "
ls_html = ls_html + " panControl: true, "
ls_html = ls_html + " zoomControl: true, "
ls_html = ls_html + " mapTypeControl: false, "
ls_html = ls_html + " scaleControl: false, "
ls_html = ls_html + " streetViewControl: false, "
ls_html = ls_html + " overviewMapControl: false "
ls_html = ls_html + " } " + char(13) + char(10)
ls_html = ls_html + " map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); "
ls_html = ls_html + "codeAddress(); "
ls_html = ls_html + " } "
ls_html = ls_html + " function codeAddress() { "
ls_html = ls_html + " var address = "

//A continuacion cargo los datos seleccionados en la datawindows que contiene el cliente //seleccionado:

ls_calle = this.tabpage_personales.dw_personales.getitemstring( 1,"pacientes_direccion_atencion")
ls_ciudad = this.tabpage_personales.dw_personales.getitemstring( 1,"localidades_nombre_localidad")

ls_direccion = "'" + ls_calle + ", " + ls_ciudad + "'"
this.tabpage_mapa.st_direccion.text = "Direccion: " + ls_calle + ", " + ls_ciudad

ls_html1 = " ; "
ls_html1 = ls_html1 + " geocoder.geocode( { 'address': address}, function(results, status) { "
ls_html1 = ls_html1 + " if (status == google.maps.GeocoderStatus.OK) { "
ls_html1 = ls_html1 + " map.setCenter(results[0].geometry.location); "
ls_html1 = ls_html1 + " var marker = new google.maps.Marker({ "
ls_html1 = ls_html1 + " map: map, "
ls_html1 = ls_html1 + " position: results[0].geometry.location "
ls_html1 = ls_html1 + " }); "
ls_html1 = ls_html1 + " } else { "
ls_html1 = ls_html1 + " alert('La direccion no ha sido encontrada. Codigo de error: ' + status); "
ls_html1 = ls_html1 + " } "
ls_html1 = ls_html1 + " }); "
ls_html1 = ls_html1 + " } "
ls_html1 = ls_html1 + " </script> "
ls_html1 = ls_html1 + " </head> "
ls_html1 = ls_html1 + " <body onload='initialize()'> "
ls_html1 = ls_html1 + " <div id='map_canvas' style='width:100%; height:100%'></div> "
ls_html1 = ls_html1 + " </body> "
ls_html1 = ls_html1 + " </html>"

ls_html = ls_html + ls_direccion + ls_html1

oleobject pagina
pagina = this.tabpage_mapa.ole_navegador.Object.Document

if isnull(pagina) then
this.tabpage_mapa.ole_navegador.Object.Navigate("about:blank", 0, "", "", "")
end if

this.tabpage_mapa.ole_navegador.Object.Document.designMode = "On"
this.tabpage_mapa.ole_navegador.object.document.Clear()
this.tabpage_mapa.ole_navegador.object.document.Open()
this.tabpage_mapa.ole_navegador.object.document.write(ls_html)
this.tabpage_mapa.ole_navegador.Object.Document.designMode = "Off"
this.tabpage_mapa.ole_navegador.object.document.close()
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder