mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-01 05:10:41 +00:00
What's the proper way to render custom text or custom items in the "key"/"label" of a TreeNode? #7505
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#7505
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?
Version/Branch of Dear ImGui:
v1.90.1 WIP + docking
Back-ends:
N/A
Compiler, OS:
Windows
Full config/build information:
Details:
What's the Proper way to render custom text or custom items in the body of a TreeNode :
I am creating a general Tree style console application and want to be able to do more then the standard TreeNode label that TreeNode provides.
For example id like to be able to have the Arrow, Blue text, And then a white colon

The current solution is
But there's one fairly glaring issue with this. Its that the Text "SubObject" Is far too close to the Arrow. When i add Text into the Label the spacing looks correct. But for some reason things behave slightly differently when you pass in a blank label. I'm aware i can probably just manually set the X Cursor position to be the start of the line + ImGui::GetTreeNodeToLabelSpacing(), Or find the magic value to indent by. But I am just wondering if there is a cleaner way to go about it.
Screenshots/Video:
Minimal, Complete and Verifiable Example code: