imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Button with wrapped text

Open OmhaRobin opened this issue 3 years ago • 1 comments

Version/Branch of Dear ImGui:

Version: 1.76 Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp Operating System: win10

My Issue/Question:

When I use ImGui::Button(), but the text string is too long. How can I do change the button setting so that I can draw the text on the button in a style of multilines? By setting the button size , and tell it in a style of multilines. I think it is similar to the word wrapping. Should I try other ways?

Screenshots/Video image Like this: I need word wrap automatically, below is the result of manually adding a line break \n. image The word wrapping: image

OmhaRobin avatar Jul 29 '22 16:07 OmhaRobin

This is currently not supported, but you could wrap the text yourself. You may use the same logic as used in the lower-level text functions.

In some cases you could use TextWrapped() and IsItemClicked() but this doesn’t provide the full set of behaviors that Button providez

ocornut avatar Jul 29 '22 17:07 ocornut