[Solved] Making texteditor with zui

I want to make text editor like thingie in Zui with haxe.

What i want is to have a single-line input text widget on bottom when someone type something and hit enter it should create text widget(not inputable)(ui.text) on top with content of whatever the person typed, just like simulating chating app like Discord.

I can get all thing done but the only thing i need to know is how to create a text-field(ui.text) at run time in a certain tab(ui.tab) when a button(ui.button) is pressed.

The thing is to make terminal like functionality

I know that Haxe-ui is better for this job but Zui look slick and cool.

1 Like

Hm maybe something like this would be a start? (It’s not a complete example but you probably know where to put those lines).

var lines:Array<String> = [];

// ...

if (ui.button("Submit")) {
	lines.push("Line text");
}

for (l in lines) {
	ui.text(l);
}

oh sorry I meant to do it in canvas, but I did it, what i did was create element(line element here) with code and so every time the button is pressed it push previously made element in canvas’s element array with this new element’s y pos more than previous element’s height, so it simulate chat, in no way it is perfect but it get the thing done for a game, if anyone want to know more i can share the code here

And BTW, how to control canvas theme with code? i am trying to change button and text box color from canvas editor but it doesn’t work