Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
matteomandelli opened this issue Jun 8, 2017 · 2 comments
Closed
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@matteomandelli
Copy link

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

@ocornut
Copy link
Owner

ocornut commented Jun 8, 2017

Please read the FAQ about labels, identifiers and how the ID stack works!

@ocornut ocornut closed this as completed Jun 8, 2017
@matteomandelli
Copy link
Author

Ops missed that.
That worked.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
label/id and id stack implicit identifiers, pushid(), id stack
Projects
None yet
Development

No branches or pull requests

2 participants