Google map
Google map
I have that code which is ok
WebBrowser1.Navigate('about:blank');
while WebBrowser1.ReadyState <> READYSTATE_COMPLETE do
begin
Application.ProcessMessages;
Sleep(0);
end;
if Assigned(WebBrowser1.Document) then
begin
aStream.Clear;
try
aStream.WriteBuffer(Pointer(HTML)^, Length(HTML));
aStream.Seek(0, soFromBeginning);
(WebBrowser1.Document as
IPersistStreamInit).Load(TStreamAdapter.Create(aStream, soReference));
finally
aStream.Free;
end;
on document complete i do... it is ok
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
HTMLWindow2 := (WebBrowser1.Document as IHTMLDocument2).parentWindow;
the problem is that i want to execute the script automatically.
HTMLWindow2.execScript('SetMyMap()', 'JavaScript');
if i execute it with a button it is ok but not after HTMLWindow2 :=...
It seems that HTMLWindow2 := takes TIME.
Where do i put it?and what condition to check to execute
AUTOMATICALLY.
I need to load google.maps.Polyline the moment i load the map.
The HTML is ok no problem.
I have that code which is ok
WebBrowser1.Navigate('about:blank');
while WebBrowser1.ReadyState <> READYSTATE_COMPLETE do
begin
Application.ProcessMessages;
Sleep(0);
end;
if Assigned(WebBrowser1.Document) then
begin
aStream.Clear;
try
aStream.WriteBuffer(Pointer(HTML)^, Length(HTML));
aStream.Seek(0, soFromBeginning);
(WebBrowser1.Document as
IPersistStreamInit).Load(TStreamAdapter.Create(aStream, soReference));
finally
aStream.Free;
end;
on document complete i do... it is ok
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
HTMLWindow2 := (WebBrowser1.Document as IHTMLDocument2).parentWindow;
the problem is that i want to execute the script automatically.
HTMLWindow2.execScript('SetMyMap()', 'JavaScript');
if i execute it with a button it is ok but not after HTMLWindow2 :=...
It seems that HTMLWindow2 := takes TIME.
Where do i put it?and what condition to check to execute
AUTOMATICALLY.
I need to load google.maps.Polyline the moment i load the map.
The HTML is ok no problem.
Comments
Post a Comment