bright-gpu-74537
12/23/2022, 4:19 PMhaxe
var d = new MyDialog();
d.onDialogClosed = function(e:DialogEvent) {
trace(e.button);
}
d.show();
bright-gpu-74537
12/23/2022, 4:20 PMbright-gpu-74537
12/23/2022, 4:20 PMbright-gpu-74537
12/23/2022, 4:21 PMvalidateDialog
)... you can just do "hideDialog" or "hide"bright-gpu-74537
12/23/2022, 4:21 PMbright-gpu-74537
12/23/2022, 4:23 PMbright-gpu-74537
12/23/2022, 4:23 PMhaxe
@:xml('
<dialog title="My Dialog" width="300" height="300">
<vbox width="100%" height="100%">
<button id="closeDialog" text="Close Dialog" />
<button id="closeDialog2" text="Close Dialog2" />
<button text="Some Dialog" />
<button text="100% x 100%" width="100%" height="100%" />
</vbox>
</dialog>
')
class MyDialog extends Dialog {
public function new() {
super();
buttons = DialogButton.OK | "Custom";
closeDialog.onClick = (_) -> {
this.hideDialog("bob");
}
closeDialog2.onClick = (_) -> {
this.hide();
}
}
}
full-journalist-82607
12/23/2022, 4:25 PMfull-journalist-82607
12/23/2022, 4:29 PMbright-gpu-74537
12/23/2022, 4:30 PMbright-gpu-74537
12/23/2022, 4:31 PMbright-gpu-74537
12/23/2022, 4:31 PMhaxe
var d = new MyDialog();
d.modal = false;
d.show();
d.onDialogClosed = function(e:DialogEvent) {
trace(e.button);
}
bright-gpu-74537
12/23/2022, 4:32 PMfull-journalist-82607
12/23/2022, 4:36 PMbright-gpu-74537
12/23/2022, 4:37 PMbright-gpu-74537
12/23/2022, 4:37 PMhaxe
public function showDialog(modal:Bool = true) {
this.modal = modal;
show();
}
bright-gpu-74537
12/23/2022, 4:37 PMbright-gpu-74537
12/23/2022, 4:38 PMfull-journalist-82607
12/23/2022, 4:46 PMbright-gpu-74537
12/23/2022, 4:46 PMbright-gpu-74537
12/23/2022, 4:47 PMsome-family-49805
12/23/2022, 11:48 PMhallowed-ocean-84954
12/24/2022, 12:07 AMhallowed-ocean-84954
12/24/2022, 3:58 AMbuilder.addGetter(f.name, f.type, macro {
var c = findComponent($v{variable}, $componentTypeExpr);
if (c == null) {
trace("WARNING: no child component found: " + $v{variable});
return haxe.ui.util.Variant.fromDynamic(null); <------- fails here
}
I add some debug and it's processing descriptionId which is a Label in the reference-library. But when it finds c is null here it is trying to return a Variant where it must be expecting a PointLight. I have now idea how it ended up confusing the too. But I'm not good with macros so while I'm guessing findComponent has probably failed I really don't know where to go from here. I've tried making ids more unique in the point-light xml but no difference.bright-gpu-74537
12/24/2022, 7:39 AMbright-gpu-74537
12/24/2022, 8:17 AMbright-gpu-74537
12/24/2022, 8:17 AM@:build(haxe.ui.ComponentBuilder.build("main-view.xml"))
class MainView extends VBox {
@:bind(this.text) var thisText:String = "tim";
@:bind(comp1.text) var comp1Text:String = "tim";
@:bind(comp2.buttonText) var comp2ButtonText:String = "jimmy";
@:bind(comp2.someObject) var comp2SomeObject:SomeObject = {a: "AAAA", b: "BBBB"};
}
bright-gpu-74537
12/24/2022, 8:18 AM@:xml('
<vbox>
<button id="theButton" text="Button" />
<label id="theLabel" text="Label" />
</vbox>
')
class SomeComponent extends VBox {
public var buttonText(get, set):String;
private function get_buttonText():String {
return theButton.text;
}
private function set_buttonText(value:String):String {
theButton.text = value;
return value;
}
public var someObject(get, set):SomeObject;
private function get_someObject():SomeObject {
var parts = theLabel.text.split("-");
return {
a: StringTools.trim(parts[0]),
b: StringTools.trim(parts[1]),
}
}
private function set_someObject(value:SomeObject):SomeObject {
theLabel.text = value.a + " - " + value.b;
return value;
}
}
bright-gpu-74537
12/24/2022, 8:18 AMhaxe
typedef SomeObject = {
var a:String;
var b:String;
}