iosHtmlViewer = Var Text of html

Is it possible to load an iosHtmlViewer with html formated text from a variable?

I need to create a dynamic table to display a bunch of numbers. I would use iosTable but it doesn’t support multiple columns.

Thanks

Rich

Yes, see: https://forum.xojo.com/conversation/post/169870

Thanks but I’m a little confuse:

Sub LoadPage(extends viewer as iOSHTMLViewer, html as Text) 
  declare sub loadHTML lib "UIKit" selector "loadHTMLString:baseURL:" (obj_id as ptr, html as CFStringRef, url as ptr)
  loadHTML(viewer.handle, html, nil)
End sub

Where exactly do i put this, as a method on the view? The declares are new to me. I do have UIKit though.

Hi Richard,
Create a module in your project. Add a method to it called LoadPage with parameters “extends viewer as iOSHTMLViewer” and “html as Text”. Then paste this into the body of the method:

declare sub loadHTML lib "UIKit" selector "loadHTMLString:baseURL:" (obj_id as ptr, html as CFStringRef, url as ptr) loadHTML(viewer.handle, html, nil)
You call it as

MyHTMLViewer.LoadPage(myAwesomeHTMLVariable)

Jason

Thank you so much!

Got a compiler error:
This method extends classiOSHtmlViewer, but the base expression is class vVaHtml

vVaHtml is the view it is on.

In the view activate I’m calling me.LoadVarHtml(lsHtml)

LoadVarHtml is in a separate module.

What am I doing wrong?

You need to call the method on the HTMLViewer object itself, and you don’t need to include the name of the module the method is in. Instead you are calling it on the view. Change your code to:
.LoadPage()
and substitute in the proper names and it will work.

Maybe I wasn’t clear, LoadVarHtml is the name of the Method in a module. I’m calling me.LoadVarHtml from the activate of the iOSHtmlViewer.

The Module name is tools.

I’m not sure then without seeing the project. Maybe @Joe Ranieri will know what triggers this compiler error so you can track down the problem?

Alert, Alert - I need more sleep!

Found the problem!

Thanks again!