IT's have possible to build a HTML-content Container control?

IT’s have possible to build a nice HTML-conent Container control? and the control’s height can self-adaption by it’s HTML Content?? how to implement it ?

You are making no sense. What’s your native language?

I think he wanted to know how to create a WebHTMLViewer within a container control, which will resize based on the content within the WebHTMLViewer.

Indeed it is difficult to understand what the OP was asking.

Yu should use http://translate.google.com to ask your questions. It will be much easier for English speaking readers. Thank you.

??? http://translate.google.com ???

WebHTMLViewer has no build in method or property to estimate the content displayed. So it seems extremely difficult to autosize it. Inside a CC or not.

Maybe a JavaScript can look at the content and report the number of lines ? I do not know JavaScript enough to presume of that solution.

Another approach, untested and a bit far fetched : make the view area an RGBSurface and examine the bottom content. It can be done by copying the windows into a picture and selecting the WHV in there. The last line has probably around 20 pixels in height. If it contains black pixels, then it means text is present on the last line, so expand the WebHTMLViewer height, and so on…

Of course the resize is limited by the height of the webpage.

You could also use the WebSDK to create a custom control that does this.

I looked at the HTML Area example. Tried to fetch a page with an HTTPSocket and set CustomHTMLArea.HTML with it, I get this :

Tried with several pages and got the same result. Seems the “Could not execute returned Javascript” prevents displaying any page that contains anything beyond pure HTML.

So even before wondering how to implement a still elusive autoresize, creating an HTMLViewer looks compromised.

WebHtmlAreaTD in Web Custom Controls reports the content size back to Xojo which you can then use to resize the control on the page.

Very interesting.

Just wondering : is the content size in bytes or points ? As far as HTML content is concerned, an image takes very little room yet takes a lot of space. It becomes difficult, then, do estimate the resize needed. Does your control detect when the content of the page reaches the height ?

Size is in points. The control merely reports the size in an event. You can decide in the event how you want to adjust the layout. The most common use is to match the control height to the height of the content within.

That is great. It is exactly what the OP needs to auto-resize. Congratulations and thank you for mentioning WebHtmlAreaTD :slight_smile: I may have the use for it as well.

[quote=89227:@Michel Bujardet]I looked at the HTML Area example. Tried to fetch a page with an HTTPSocket and set CustomHTMLArea.HTML with it, I get this :

Tried with several pages and got the same result. Seems the “Could not execute returned Javascript” prevents displaying any page that contains anything beyond pure HTML.

So even before wondering how to implement a still elusive autoresize, creating an HTMLViewer looks compromised.[/quote]

Yeah, the problem is that you can’t just insert a whole web page into a div tag like that.

All right. Thank you.