how to displaying contents of a field in oBrowser

Kelly Burgess kellyb at
Thu Apr 8 00:33:59 UTC 2021

Hi Doug,

This might have limitations, but you can give it a try...  The idea is to have a generic container as an htmlcontrol that you can plug html content into...

1. Add a folder to the htmlcontrols folder named "container"
2. Clone the "test.htm" file from the test folder in htmlcontrols into your new folder and rename it "container.htm"
3. Change the body in container.htm to give it an identifier and remove the <textarea> element.

		<body id="mainbody" style="margin:0;">

4. Add a Javascript function to the jOmnis.callbackObject script in container.htm, e.g. between omnisGetData and omnisSetData.

			  // row in this case is 2 columns: elementID chars and html chars
			  //assign html in the row.html column to the [row.elementID] mark
			document.getElementById(row.elementID).innerHTML = row.html;
			return "This could be a useful return value";

Now in Omnis you can create an oBrowser object and assign "container" to the $urlorcontrolname property, then get your html body into a character field e.g. myHTML and call that new Javascript function via the $callmethod method of the oBrowser control, passing in the html to plug into the named body element.

	Do paramsRow.$define(elementID,html)
	Calculate paramsRow.elementID as "mainbody"
	Calculate paramsRow.html as myHTML
	Do iBrowserCtrl.$callmethod('setElementHtml',paramsRow) Returns iMethod1id

You could then add the returned id to a list, if you want to track the calls.  The method runs asynchronously and sends the evCallMethodDone event to the oBrowser control on completion.  There you can look up the id to figure out which call is being completed, if you need to process errors or queue up another action.

This work with some simple html content - not sure about its ability to resolve embedded links, etc.


More information about the omnisdev-en mailing list