mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-10 19:03:30 +00:00
Question about layouts #263
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#263
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
Use PushItemWidth(-1) for left alignment.
Pass a label starting with "##" to your listbox so it is invisible.
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).
There is a height_in_items parameter to ListBox() but no explicit size to it at the moment.
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.
NB: i fixed a bug where ListBoxHeader() wouldn't take those negative sizes like other functions did.
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!