Haxe UI resize problem

(Dominik Grebien) #1

Hey there,

i have a problem with Haxe UI with the html 5 backend.
When i click the button to go to the second page (another custom xml) the resize on this page is successful and if you go to the start page and again to the second with the button it is also successful but if the page is for example smaller and you go back with the button here and the start page is resized to the original size and after that the resize does not work anymore on the second page if it is entered a second time. I have a timer function and a onresize function. The onresize function do not work.
I hope that is enough information to test this problem.

Here is the example:


(Ian Harrigan) #2

May I ask what the intention of this is:

            var timerrun = function() {
                var timer = new haxe.Timer(250);
       = function() {
                    c1.parentComponent.height = js.Browser.window.innerHeight;
                    c1.parentComponent.width = js.Browser.window.innerWidth;
                    c1.height = c1.parentComponent.height;
                    c1.width = c1.parentComponent.width;
                    testmain2.height = c1.height;
                    testmain2.width = c1.width;

If you add width="100%" height="100%" to your top level container (id="vboxcomponent") then HaxeUI will take care of all the resizing and everything works out as it should (assuming im understanding).

That said, it is a strange one as something strange is certainly happening… Ill take a look, but let me know if the width/height addition achieves what you were trying to do in the first place.


(Ian Harrigan) #3

Ok, so the problem was that your code was using Browser.window.onresize, later HaxeUI “steals” that from you and does its own thing. You could get around it by ether of these methods:

            js.Browser.window.addEventListener("resize", function() {
                trace("resize 1");

            main.registerEvent(UIEvent.RESIZE, function(e) {
                trace("resize 2");

However, I dont think HaxeUI should be doing that in the first place so will change the backend to use the addEventListener method so other places can use onresize should they wish to (or already were)

Nice find, thanks!


EDIT: there is actually something else up to be honest, I can see what it is and will fix later, but previous posts still stand somewhat. :slight_smile:

(Dominik Grebien) #4

Now it works with the 100% width and height and without a resize function. One of my problems was, that
in the body-style of the index.html have not had the 100% width and height.