TreeNode no arrow draw flag
Author: izecheruCreated Sep 17, 2026Updated Sep 17, 2026
Version/Branch of Dear ImGui:
Version 1.92.7, Branch: docking
Back-ends:
imgui_impl_sdl2.cpp + imgui_impl_vulkan.cpp
Compiler, OS:
Windows 11 + MSVC 2022
Full config/build information:
No response
Details:
This is rather a request since i can't seem to find a way to edit imgui source efficiently without formatting the code with my clang-format tool and make a PR myself.
I am using TreeNodeEx for my file explorer in the game engine that i'm building and did not like the arrows so I made some tiny changes.
All i've changed is added an ImGuiTreeNodeFlags_NoArrowDraw flag and skip the RenderBullet/ RenderArrow calls in the TreeNodeBehavior, and if this flag is found subtract the text_offset_x value from text_pos.x
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
// this is the if(display_frame) body
{
// Framed type
const ImU32 bg_col = GetColorU32( ( held && hovered ) ? ImGuiCol_HeaderActive
: hovered ? ImGuiCol_HeaderHovered
: ImGuiCol_Header );
RenderFrame( frame_bb.Min, frame_bb.Max, bg_col, true, style.FrameRounding );
RenderNavCursor( frame_bb, id, nav_render_cursor_flags );
if ( span_all_columns && !span_all_columns_label )
TablePopBackgroundChannel();
if ( !( flags & ImGuiTreeNodeFlags_NoArrowDraw ) )
{
if ( flags & ImGuiTreeNodeFlags_Bullet )
RenderBullet(
window->DrawList, ImVec2( text_pos.x - text_offset_x * 0.60f, text_pos.y + g.FontSize * 0.5f ), text_col );
else if ( !is_leaf )
RenderArrow( window->DrawList,
ImVec2( text_pos.x - text_offset_x + padding.x, text_pos.y ),
text_col,
is_open ? ( ( flags & ImGuiTreeNodeFlags_UpsideDownArrow ) ? ImGuiDir_Up : ImGuiDir_Down )
: ImGuiDir_Right,
1.0f );
else // Leaf without bullet, left-adjusted text
text_pos.x -= text_offset_x - padding.x;
}
if ( flags & ImGuiTreeNodeFlags_ClipLabelForTrailingButton )
frame_bb.Max.x -= g.FontSize + style.FramePadding.x;
if ( g.LogEnabled )
LogSetNextTextDecoration( "###", "###" );
}
// shift text back since there's no arrow drawn
if ( flags & ImGuiTreeNodeFlags_NoArrowDraw )
text_pos.x -= text_offset_x;
// Label
if ( display_frame )
RenderTextClipped( text_pos, frame_bb.Max, label, label_end, &label_size );
else
RenderText( text_pos, label, label_end, false );
Source: ocornut/imgui