kotlin-graphics/imgui

inputText issues

Closed this issue · 3 comments

Report will use example as reference.

static char[][] buf=new char[3][255];
boolean[] windowOpen=new boolean[1];

private void init() {
	buf[0][0]='a';
}

public void loop(){
	glfw.pollEvents();
	lwjglGL3.newFrame();
	float w=window.getFramebufferSize().x,h=window.getFramebufferSize().y;
	imgui.setNextWindowPos(new Vec2((w-350)/2,(h-350)/2), Cond.FirstUseEver, new Vec2());
	imgui.setNextWindowSize(new Vec2(350,350), Cond.FirstUseEver);
	if(imgui.begin("Test", windowOpen, 0)) {
		imgui.text("Test");
		for(int i=0;i<buf.length;i++) {
			imgui.text(String.valueOf(i));
			imgui.inputText("", buf[i], InputTextFlags.EnterReturnsTrue.getI());
		}
		imgui.end();
	}
	gln.GlnKt.glViewport(window.getFramebufferSize());
	gln.GlnKt.glClearColor(new Vec4(.8));
	GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

	imgui.render();
	window.swapBuffers();
}

When using multiple inputTexts, clicking on one (e.g. 0) immediately copies data to the next array in buf (e.g. 1). It does not touch buf[2]. The text boxes cannot be modified, as the cursor does not stay in them long enough to grab a character. Clicking on the last box (e.g. buf[2]) selects all boxes, copies that value to them, and works to edit text, but for all boxes at one.

Side note: this still happens if buffers are not in a large array, they could be buffer[], james[], and monero[] and this still happens.

I'll look into that

It's tricker than I thought..

Did you have the chance to look into the code? Any hint where this may come from?

it's working now for whatever reason. no changes at all