imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Components outside of main window ?

Open philippeflorent opened this issue 6 months ago • 4 comments

Version/Branch of Dear ImGui:

Version 1.XX, Branch: XXX (master/docking/etc.)

Back-ends:

imgui_impl_XXX.cpp + imgui_impl_XXX.cpp

Compiler, OS:

win 10

Full config/build information:

Hi,

this is not a n issue but more of a request, I just did not find any ImGui forum

can someone read this question and answer me ?

https://discourse.libsdl.org/t/components-outside-windows/59924

thanks for your help and feel free to delete this non-issue

thanks for your help

Details:

My Issue/Question:

XXX (please provide as much context as possible)

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();

philippeflorent avatar Jun 03 '25 19:06 philippeflorent

Multi-Viewports is likely what you want.

thanks for your help and feel free to delete this non-issue

While some communities have dedicated support forums, Dear ImGui does not. It's OK to post questions on the issue tracker here. (Think of it as "I have an issue that I need help solving")

PathogenDavid avatar Jun 03 '25 20:06 PathogenDavid

Hi thanks for helping but I can create multiple window, that is not a problem

my problem is to link them like in the image I posted

philippeflorent avatar Jun 03 '25 20:06 philippeflorent

You beat me to my follow-up comment. I realized I probably focused too much on the "main window" part of your title, sorry about that!

It's not totally clear what you're wanting to do based on your screenshot, and between the formatting issues and unnecessary cruft your code is a bit messy so I'm not keen on trying to guess from it.

Are you trying to draw things outside of the window bounds?

If you're trying to make a node editor, consider using one of the existing extensions.

If you're just trying to draw things in general, submit draw commands to ImGui::GetBackgroundDrawList(). See Examples > Custom rendering > BG/FG draw lists for an example. (Note that this does not work with multi-viewports.)


If you're wanting to use actual widgets outside of your window, you can use ImGui::PushClipRect to override the clipping rectangle, see example below.

However, this isn't super supported. It won't work as expected with interactive widgets (in the example below, the portion of the button outside of the window will not be clickable.) This also won't work with multi-viewports.

ImGui::Begin("Hello, world!");

float oldX = ImGui::GetCursorPosX();
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::PushClipRect(viewport->WorkPos, { viewport->WorkPos.x + viewport->WorkSize.x, viewport->WorkPos.y + viewport->WorkSize.y }, false);
ImGui::SetCursorPosX(oldX - 50.f);
ImGui::Button("Test button!");
ImGui::PopClipRect();

// ...

ImGui::End();

Looks like this:

Screenshot of Dear ImGui window with button hanging off of the side

(If none of the above applies, please clarify your question and explain what you're trying to accomplish rather than the solution you think you need. IE: Avoid the XY problem.)

PathogenDavid avatar Jun 03 '25 20:06 PathogenDavid

oh yeah that seems to be it, node editor, it even seem to have nice splines for the links I'll have a look thanks

philippeflorent avatar Jun 03 '25 20:06 philippeflorent