html layout view for help/doco presentation? (native.newWebView() to show local HTML?)

What’s the best way to display formatted static content to a user in Corona SDK?  For example for your help page.  

I note there is a native.newWebView() API I see, however it takes a URL.  In this case I can have the HTML formatted locally.  Is there no way in corona to say “display this HTML”?    If yes would then like to place it in a scrollView widget so you could scroll up and down the content.    

Hi greg886,

How about…

local webView = native.newWebView( display.contentCenterX, display.contentCenterY, 320, 480 )
webView:request( “localfile.html”, system.ResourceDirectory )

http://docs.coronalabs.com/api/library/native/newWebView.html#TOC

Best.

doh - thanks develephant - didn’t go through the api very well - thought I had looked and only saw a url… 

Great interview on Corona Geek podcast by the way, with heaps of info/learning there.  …if only I had more time for app dev to try to tackle a more complex app like one that had turn based game play etc that would be great :slight_smile:

Hi greg886,

You’re very welcome.  I just used it myself recently so it was an easy answer. :slight_smile:

Cheers.

Getting back to this I’ve just noted this doesn’t really solve what I was after as it doesn’t allow you to see the layout in the simulator.  I get this on my Mac when building the WebViewPhysics sample project.

native.newWebView() does not work in the Corona Simulator. Please build for device (or Xcode simulator) for this sample to work properly.

Also (haven’t tried it) but the API says you actually need a file to pass to it, whereas I would like to pass it a string variable with the HTML in it.  

Posted a more specific question here:  http://forums.coronalabs.com/topic/45086-html-layout-view-that-works-in-simulator-for-helpdoco-presentation/

Well you will have to build for device to test it. That’s just the way it is. As for passing the string why don’t you save it to a temp file and load it?

will be dynamic view so will have elements having to be updated multiple times a second…

Hi greg886,

How about…

local webView = native.newWebView( display.contentCenterX, display.contentCenterY, 320, 480 )
webView:request( “localfile.html”, system.ResourceDirectory )

http://docs.coronalabs.com/api/library/native/newWebView.html#TOC

Best.

doh - thanks develephant - didn’t go through the api very well - thought I had looked and only saw a url… 

Great interview on Corona Geek podcast by the way, with heaps of info/learning there.  …if only I had more time for app dev to try to tackle a more complex app like one that had turn based game play etc that would be great :slight_smile:

Hi greg886,

You’re very welcome.  I just used it myself recently so it was an easy answer. :slight_smile:

Cheers.

Getting back to this I’ve just noted this doesn’t really solve what I was after as it doesn’t allow you to see the layout in the simulator.  I get this on my Mac when building the WebViewPhysics sample project.

native.newWebView() does not work in the Corona Simulator. Please build for device (or Xcode simulator) for this sample to work properly.

Also (haven’t tried it) but the API says you actually need a file to pass to it, whereas I would like to pass it a string variable with the HTML in it.  

Posted a more specific question here:  http://forums.coronalabs.com/topic/45086-html-layout-view-that-works-in-simulator-for-helpdoco-presentation/

Well you will have to build for device to test it. That’s just the way it is. As for passing the string why don’t you save it to a temp file and load it?

will be dynamic view so will have elements having to be updated multiple times a second…