Hey List, Hey Ian.
I am having trouble creating a custom component in haxeui following: http://haxeui.org/wiki/en/Custom_Components
I have this CustomComponent.hx:
import flash.events.MouseEvent;
import haxe.ui.toolkit.containers.HBox;
import haxe.ui.toolkit.controls.Button;
import haxe.ui.toolkit.controls.Text;
import haxe.ui.toolkit.events.UIEvent;
import haxe.ui.toolkit.core.ClassManager;
class CustomComponent extends HBox {
var label: Text;
var button: Button;
public function new() {
super();
style.borderColor = 0x0080C0;
style.borderSize = 1;
button = new Button();
button.text = "button";
button.onClick = onClickButton;
addChild(button);
label = new Text();
label.text = "Default Text";
addChild(label);
}
private function onClickButton(e:UIEvent):Void {
label.text = "Button Clicked!";
}
}
and this Main.hx:
import haxe.ui.toolkit.core.Macros;
import haxe.ui.toolkit.core.Toolkit;
import haxe.ui.toolkit.core.Root;
import haxe.ui.toolkit.controls.Button;
import haxe.ui.toolkit.core.ClassManager;
class Main {
public static function main() {
Macros.addStyleSheet("styles/gradient/gradient.css");
ClassManager.instance.registerComponentClass(CustomComponent, "customcomponent");
Toolkit.init();
Toolkit.openFullscreen(function(root:Root) {
Toolkit.processXmlResource("assets/view.xml");
});
}
}
this is my view.xml:
<?xml version="1.0" encoding="utf-8" ?>
<vbox >
<customcomponent/>
</vbox>
now I compile it:
> lime test linux
and get a windows
showing nothing … (not as advertised on the haxeui site).
Why?
Thanks!
Nathan
Hey,
Stupid me.
There should be a:
root.addChild(Toolkit.processXmlResource("assets/view.xml"));
in the code. Now it works.
Sorry for the disturbance :).
Cheers,
Nathan
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
--