delphi - TDirectionsResult from a Memo -
with code below trying reload directionsresult tgmdirections.
procedure form2.button2click(sender: tobject); var dr: tdirectionsresult; i: integer; begin dr:= tdirectionsresult.create(form1.fdirection, 0); dr.xmldata.beginupdate; i:= 0 memo1.lines.count - 1 begin dr.xmldata.append(memo1.lines[i]); end; dr.xmldata.endupdate; showmessage(form1.fdirection.directionsresult[0].routes[0].leg[0].endaddress); end;
all seems until showmessage list out of bounds message. take dr has not been created or memo has not loaded directionsresult.
further adaption has confirmed directionsresult[0] not exist.
help correction appreciated.
you can't add tdirectionsresult directionsresult array programatically, need invoke execute method tgmdirections object.
however can this
procedure tform1.button1click(sender: tobject); var dr: tdirectionsresult; begin dr:= tdirectionsresult.create(gmdirection1, 1); dr.xmldata.text := memo1.lines.text; showmessage(dr.routes[0].leg[0].endaddress); end;
that is, can work without problems object , can access properties , methods.
note assignation between xmldata , memo.lines, don't assign line line because control of xml made on onchange event of xmldata.
regards.
Comments
Post a Comment