Jump to content

Javascript and UniURLFrame


FastCards

Recommended Posts

I've got the Google Charts API thing working (thanks to the poster who posted the sample code, I will post my code when it's all working)

 

Basically, I build the HTML in Delphi code (which I know inside out) then pass that HTML to a UniURLFrame and it displays fine. All is good with the world.

 

However, if I want to re-draw the chart because the user has selected different options, it doesn't work. If I assign new HTML to the UniURLFrame it doesn't draw and produces errors. Without going into detail, these errors are caused because I have already loaded things and created things in the Javascript HTMl the first time round.

 

My question is this: is this the right way to do this sort of thing (i.e. assign HTML to a UniURLFrame) or is there a better way to do it? If this was in Windows development, you would clear what had gone before, then change the HTML then call a refresh method or the like to load in the new HTML. I know this isn't how JavaScript works but any pointers would be gratefully received.

 

Thanks and all the best to all in the Unigui community :-)

 

Andy

Link to comment
Share on other sites

UniHTMLFrame didn't work. But... I looked at the sample code again (thanks to forum member fcarvalho4) and discovered that if you replace the text in the HTML property of UniURLFrame with new text, it doesn't work. If instead you replace the bits of text that you want to change, it does work.

 

So, basically, this doesn't work

 

UniURLFrame1.HTML=NewText

 

But this does

 

UniURLFrame1.HTML.Text := StringReplace(UniURLFrame1.HTML.Text,TheOldText,TheNewText,[rfReplaceAll]);

 

Happy days...

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...