Skip to content

InputText can't keep focus #2116

@TommyThree

Description

@TommyThree

I have the code below. I have to hold down the mouse button on the input box to be able to type in it. Otherwise it looks like it gets focus for a second then loses it. What do I do about this?

if (showGameObjects)
		{
			if (ImGui::Begin("Game Ojects", &showGameObjects))
			{
				static int selected = -1;
				for (int i = 0; i < meshList.size(); i++)
				{
					if (ImGui::Selectable(meshList[i].name.c_str(), selected == i))
					{
						selected = i;
						pickedTarget.index = i;

						XMVECTOR s, r, t;
						XMMatrixDecompose(&s, &r, &t, meshList[i].worldMat);
						XMVECTOR dist = XMVector3Length((cam.GetPositionXM() - t));
						XMFLOAT3 dis;
						XMStoreFloat3(&dis, dist);
						pickedTarget.distance = dis.x;
					}
				}


				
				static char buf[64] = "";

				ImGui::InputText("Rename", buf, 64);

				if (ImGui::Button("Rename", ImVec2(120, 30)))
				{
					if (strlen(buf) != 0)
						meshList[pickedTarget.index].name = buf;

				}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions