Skip to content

Selection does not work if multiple Selectable have same label. #1173

@matteomandelli

Description

@matteomandelli

Hi,

While creating a table I noticed that if the labels of more than one Selectable are the same
then the selection does not work.

Here's an example that show the issue

#define SHOW_ISSUE 1
	static bool windowOpen = true;
	ImGui::Begin("test",&windowOpen);
	ImGui::Columns(1);
	char buffer[10];
	static int selected = 0;
	for (int i = 0; i <3; ++i)
	{
#if SHOW_ISSUE
		sprintf(buffer, "test");
#else
		sprintf(buffer, "%d", i);
#endif
		if (ImGui::Selectable(buffer, i == selected, ImGuiSelectableFlags_SpanAllColumns))
			selected = i;
	}
	ImGui::End();

Is there a way to make the selection work on multiple rows with same text?

Thank you,
Matteo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions