i have the problem that i can´t center a button with Haxe UI version 2.
In the builder on haxeui.org it works fine.
When i atempt to compile it in html5 i doesn´t work.
Do you have any more info? when you say html5 do you mean haxeui-html5 backend? Or, say, haxeui-openfl deployed to html5? Which browser? Does the snippet above work for you?
Right, so there are two issues here regarding % widths:
First is that your outermost vbox doesn’t have “width=100%”… which means its autosized (ie, it will resize based on the contents of it)… However, the other components in are set to 100%… so the outermost vbox cant calc its width correctly. Basically, it is being set to 0 and the sub components (width = 100%) are 100% of that (ie, 0).
The second is you are using a custom component (Testbutton), im not sure if its intentional, but that is also set to autosize and later its contents are all 100% (so the same issue as above). Few ways to fix that;
in code use: percentWidth = 100; in the Testbutton constructor
set the width to 100% in main.xml (<testbutton width="100%" />)
use the .testbutton-container { width: 100%} as css somewhere (you could also give the instance an id and use #mything1 if you wanted to also ofc)
So basically what i did was to set the top level vbox to 100% and the <testbutton/> to 100%: