How to add components from XML only?

So, after component aliasing was removed in v1.3, it seems i cant get xml-only components to work (in 1.4)…adding either file="…" or folder="…" in module.xml does not seem to work … Any idea?

@:build(haxe.ui.ComponentBuilder.build("src/ui/testview.xml"))
class MainView extends VBox
....

testview.xml :

<?xml version="1.0" encoding="utf-8" ?>
<vbox >
    <topmenu width="100%" />
</vbox>

module.xml : (in “src” …neither folder or component seem to work…)

<module>
    <components>
        <class folder="../src/ui" />
        <component file="../src/ui/topmenu.xml" />
    </components>  
</module>
no class found for component: topmenu
C:\HaxeToolkit\haxe\lib\haxeui-core/1,4,0/haxe/ui/macros/ComponentMacros.hx:207: characters 70-83 : Unknown identifier : c0
C:\HaxeToolkit\haxe\lib\haxeui-core/1,4,0/haxe/ui/macros/ComponentMacros.hx:207: characters 70-83 : ... For function argument 'child'
src/MainView.hx:9: lines 9-114 : ... Defined in this class

but…

< import resource=“topmenu.xml” /> works just fine.

Am i missing somthing here? :slight_smile:

Interesting, i might have borked it since 1.3. Leave it with me, ill check it out - thanks for the example too!

Cheers,
Ian

1 Like

image

So, it seems to work “ok” for me, i did have to make one very simple change, but it didnt stop haxeui finding the components (it just meant the base class of the components was wrong). Heres my module.xml:

<?xml version="1.0" encoding="utf-8" ?>
<module>
    <components>
        <class package="custom" />
        <component file="assets/custom/custom2.xml" />
        <class folder="assets/custom" />
    </components>
</module>

Maybe your paths are wrong? Ill attach my test app here: https://easyupload.io/tjf51q - let me know if the problem exists in that also.

As i said, you will need to grab latest haxeui-core (git version) but thats for another thing (all xml only custom components were extending from Box always - not the root item in the xml - but thats not the issue you were facing)

Cheers,
Ian

Hi Ian.
Thanks for the help.I was using haxeui from haxelib 1.4 release.
Then this is what i got when running your example :
result

But it seems that now, with updating to the current version from git - it works like it should,
so i think your fix solved the problem! Thanks alot!!! :slight_smile:

1 Like

Cool - yeah, that last issue (with the buttons not being in an hbox) was how mine looked originally until i added that fix - glad its working!

Cheers,
Ian