-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Question about layouts #263
Comments
Use PushItemWidth(-1) for left alignment. |
Nice thanks 👍 any idea about increasing the listbox height? Seems there isn't a PushItemHeight? Edit: Or rather how do I know how many items it would take so it fills the dialog up to the button. |
PushItemWidth() is a separate thing because it pertain to many widgets (although this system will be revampd). You can create a more custom Listbox by calling its inner functions yourself, basically you want to call BeginChildFrame() / EndChildFrame() and stick a bunch of Selectable() inside. This is roughly was ListBox() does. I could perhaps add a variant of ListBox() with an explicit size. edit ListBox high-level helpers are poorly designed I think. If you pass (0.0f, -100f) size to BeginChildFrame() it'll leave 100 of vertical space. You may want to use (0.0f, -ImGui::GetItemsLineHeightWithSpacing) here. |
…inChild() or BeginChildFrame() (#263)
NB: i fixed a bug where ListBoxHeader() wouldn't take those negative sizes like other functions did. if (ImGui::ListBoxHeader("test", ImVec2(0, -20)))
{
ImGui::Selectable("aaa");
ImGui::Selectable("aabb");
ImGui::ListBoxFooter();
} Although the difference between ListBoxHeader() and BeginChildFrame() is only that the earlier has a label so if you don't need one you can use BeginChildFrame() anyway. |
@paulsapps Did you get that working? |
I didn't try the auto sizing of the listbox by creating my own yet, but I'm certain it will work with the info you've provided :) thanks! |
So I've got the following UI:
Using ImGui::CollapsingHeader, ImGui::InputText, ImGui::ListBox and ImGui::Button. How can I make the input text and listbox take the full width of the window like the button? For the button I used:
if (ImGui::Button("Play", ImVec2(ImGui::GetWindowWidth(), 20)))
Also is there some way to make the list box use up all of the vertical space?
I'm aiming for something like this:
The text was updated successfully, but these errors were encountered: