Skip to content

ImageButton does not responds to click in certain situations #4471

@alexgg-developer

Description

@alexgg-developer
Dear ImGui 1.84 WIP (18309)
--------------------------------
sizeof(size_t): 4, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _MSC_VER=1916
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_vulkan
io.ConfigFlags: 0x00000441
 NavEnableKeyboard
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000140E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1600.00,900.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

My Issue/Question:

We have an application to manage meshes and materials in scenes. We show the hirarchy of the scene in a docked window and a sort of tree widget we had using the old column system. We noticed that with scenes with several meshes (50+) sometimes buttons to hide/lock the mesh did not work in this docked window even though it did not happen anywhere else. I thought maybe it was time to upgrade so I passed the column system to the tree widget system in the new version but keeps happening. It's not a problem with code because it just simply that you click some buttons and it returns false. The buttons are Imgui::ImageButton.
I could not reproduce writing a simple example but I will upload it just in case you want to see the structure of the gui that is more or less the same.

While I was writing the example I remembered the ImGui::IsItemClicked function, and when I use it after the ImageButton it responds correctly to my click so that is the workaround I'm using right now, but I thought it would be useful to inform about the issue.

Screenshots/Video

2021-08-20.08-58-02.mp4

Standalone, minimal, complete and verifiable example: (see #2261)

imgui-docking.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions