HtmlPanel contains
with hardcoded(?) 100x50 size.

Answered
0
0

Hello,

I’ve been trying to get the H5P Framework to work in a Wisej application. Everything seems to be working now except for one thing: The HtmlPanel that “hosts” the H5P content contains a <div> which appears to have a fixed size of 100px * 50px, specified directly in its “style” attribute. If I remove these properties from the style or resize the panel (e.g. by resizing the window) everything seems to work. The div isn’t part of my code, it also has the “qx-widget” class.

After removing the width and height properties it all works:

Is there any way to either remove/disable this div (or its width and height properties), or have its size updated? I guess it might have to do with H5P being loaded after the size of the div is set.

  • You must to post comments
Best Answer
0
0

The event is “resize” and the handler is __onPaneResize and the resize method is __updateHtmlSize. The “resize” event is fired by the inner “pane” which is the scrollable container that contains the custom html in a wisej.web.ScrollableHtmlPanel javascript class.

You need to have the instance reference to the wisej.web.ScrollableHtmlPanel widget to invoke a resize. But you have it in “this” you can do:

this.__updateHtmlSize();

If you know where it is, lets say it’s a control in the MainPane, you can do this:

App.MainPage.htmlPanel1.__updateHtmlSize();

Your entire control object model available by name and hierarchy in the browser under App. So if htmlPanel1 is a child of panel1, you have to refer to it as:

App.MainPanel.panel1.htmlPanel1.__updateHtmlSize();

You can explore the object model easily with F12 and type App.

Also, the entire source code for all Wisej widgets is available in clear when running in debug mode at http://localhost/resource.wx/wisej.js and http://localhost/resource.wx/qx.js. You can step in, debug it, and even change it.

 

  • You must to post comments
0
0

I’m implementing this inside a Widget, so I have a reference to the Widget in the InitScript. This also allows me to access the HtmlPanel.

Calling __updateHtmlSize() in the wisej.utils.Loader.load callback appears to work. Thanks!

  • You must to post comments
0
0

Hi,

I wanted to come back to this issue: Changing the size of the HtmlPanel does indeed work. But it’s kind of ugly to do it periodically. I’d like to ask if you could give me the JS code that triggers the resize. I have the Wisej JS loader invoke a JS callback when it is done loading the H5P scripts, so I guess this would be a perfect place to trigger a resize.

Thanks,
Marian

  • You must to post comments
0
0

It’s not hard coded, it’s calculated when the content is displayed, when the size of the HtmlPanel is changed, and when the scrollbars are forces off. It’s necessary to calculate it to manage the container’s scrollbar since we use themed scroll bars.

If the internal html content runs some javascript that dynamically changes the size of the html content, it will not update the container. There is no javascript event on an element changing the size. There are two ways to do this, one is to start a timer and periodically resize, the other is to trigger the resize when the content is resize in case the javascript library (H5P?) fires some event when is rendered.

Try to increase the height of the HtmlPanel by 1 pixel after the H5P content is fully displayed and let me know if the content is resized. In case I can give you a simple javscript that triggers the resize on a timer.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.