[RESOLVED] - Component 'alias' in Module isn't applying to the component class


i don’t know should i open a Github issue ? but posting here .

Alias not working with <component> tag:

the problem is i can’t use Alias name when using component tag, but it is working when i am providing the actual class name.

Alias working with <class> tag:
i can use alias with class tag.

what do you suggest which one will be more reliable i mean does those two tags work differently ?

The project files:

here’s my Module.xml

<?xml version="1.0" encoding="utf-8"?>
<module id="test_module">

		<resource path="../assets/images" prefix="images" />

		<component class="ui.testcomp.CustomTestComp" alias="TestComponentSim" />
		<class name="ui.testcomp.CustomTestComp" alias="TestComponent" />

my Main.xml

<?xml version="1.0" encoding="utf-8"?>
<vbox id="main" width="100%" height="100%" style="padding:15px;spacing:15px;">
    <CustomTestComp />
	<TestComponent />    	

my TestComponent.xml

<?xml version="1.0" encoding="utf-8"?>
	<textfield id="txtCount" text="0" />
	<button id="btnInc" text="INCREMENT +" />
	<button id="btnDec" text="DECREMENT -" />

my CustomTestComp.hx file

class CustomTestComp extends Box
	public var txtCountValue:String = "100";

	public function new()

	@:bind(btnInc, MouseEvent.CLICK)
	private function onIncrement(e:MouseEvent):Void
		var number = Std.parseInt(txtCountValue) + 1;
		txtCountValue = Std.string(number);

	@:bind(btnDec, MouseEvent.CLICK)
	private function onDecrement(e:MouseEvent):Void
		var number = Std.parseInt(txtCountValue) - 1;
		txtCountValue = Std.string(number);



class Main
	public static function main()
		var app = new HaxeUIApp();
			var main:Component = ComponentMacros.buildComponent("assets/ui/main.xml");

i really like the @:bind thing :blush: just like butterknife in java .


i noticed one more things when using <component> tag and if i put wrong path to the component xml


it will just compile and not render anything.

but if i use <class> tag it will give me compile time error that the path to xml is incorrect which is really helpful.

I dont think “component” is a valid node under “components”… only “class”… … that said, i think it probably should be, so i think ill add it.

EDIT: added

1 Like

perfect, actually i was following this guide