Skip to content

If multiple InputText's are created via loop, whenever I select one when running my app, it deselects it. #4395

@Stanlyhalo

Description

@Stanlyhalo

Version: 1.83
Branch: docking

My Issue/Question: If multiple InputText's are created via loop, whenever I select one when running my app, it deselects it.

I've been creating a game engine in Vulkan, and the UI with imgui, but as I started to make my entity inspector, it seems when I create input text via looping, whenever I select an input, it deselects it, and if I select the input that was the last one created, it selects all of them and i can edit the text in all of the inputs.

Here's the code of what I have:

for (int i = 0; i < storage.sel_gameEntities.size(); i++) {
	std::string s = std::to_string(storage.sel_gameEntities[i][0]->getId());
	if (ImGui::CollapsingHeader(std::string(std::string(storage.sel_gameEntities[i][0]->name) + "###" + s).c_str(), ImGuiTreeNodeFlags_None))
	{
		ImGui::InputText("Name", storage.sel_gameEntities[i][0]->buf_name, 64);
		storage.sel_gameEntities[i][0]->name = storage.sel_gameEntities[i][0]->buf_name;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions