ImGui::IsWindowAppearing detect window opening vs tabbing #9542

Open
opened 2026-09-11 17:05:15 +00:00 by amuTBKT · 15 comments
amuTBKT commented 2026-09-11 17:05:15 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

Version 1.93.0, Branch: docking

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx11.cpp

Compiler, OS:

Windows 10 + MSVC 2026

Full config/build information:

Dear ImGui 1.93.0 WIP (19295)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1944
define: _MSVC_LANG=201402
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
IM_ASSERT: runs expression: OK. expand size: OK
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx11
io.ConfigFlags: 0x00000483
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
 ViewportsEnable
io.ConfigDpiScaleFonts
io.ConfigDpiScaleViewports
io.ConfigViewportsNoDecoration
io.ConfigViewportsNoDefaultParent
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00003C1E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 HasParentViewport
 RendererHasVtxOffset
 RendererHasTextures
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,128
io.Fonts->FontLoaderName: stb_truetype
io.DisplaySize: 1264.00,761.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

Details:

Apologies for a bit of a lazy bug-report/question.

I was wondering if there is a way to detect if window is appearing from a closed state vs just becoming active (from inactive tab) ?
I have mostly relied on ImGui::IsWindowAppearing for setting focus on widgets and doing heavy per window init work (like refreshing data for list views), but I am noticing when tabbing it triggers that logic too.

I can see that it makes sense (window is appearing), but is there a way to differentiate b/w opening vs getting activated?

I looked around a bit and found this issue which looks relevant (https://github.com/ocornut/imgui/issues/4177) but I am not sure if that answers my question.
I can solve this issue by manual bookeeping but wanted to check if theres any better/existing solution.

Screenshots/Video:

Image

Minimal, Complete and Verifiable Example code:

// you will have to dock this window

if (ImGui::Begin("BugRepro"))
{
    if (ImGui::IsWindowAppearing())
    {
        // set focus to first input text when window opens
        ImGui::SetKeyboardFocusHere();
    }

    static char buf1[32] = { 0 };
    ImGui::InputText("Text", buf1, sizeof(buf1));

    // add bloat....
    ImGui::Dummy(ImVec2(0, 400.f));

    static char buf2[32] = { 0 };
    ImGui::InputText("SomeOtherText", buf2, sizeof(buf2));
}
ImGui::End();
### Version/Branch of Dear ImGui: Version 1.93.0, Branch: docking ### Back-ends: imgui_impl_win32.cpp + imgui_impl_dx11.cpp ### Compiler, OS: Windows 10 + MSVC 2026 ### Full config/build information: ```cpp Dear ImGui 1.93.0 WIP (19295) -------------------------------- sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20 define: __cplusplus=199711 define: _WIN32 define: _WIN64 define: _MSC_VER=1944 define: _MSVC_LANG=201402 define: IMGUI_HAS_VIEWPORT define: IMGUI_HAS_DOCK IM_ASSERT: runs expression: OK. expand size: OK -------------------------------- io.BackendPlatformName: imgui_impl_win32 io.BackendRendererName: imgui_impl_dx11 io.ConfigFlags: 0x00000483 NavEnableKeyboard NavEnableGamepad DockingEnable ViewportsEnable io.ConfigDpiScaleFonts io.ConfigDpiScaleViewports io.ConfigViewportsNoDecoration io.ConfigViewportsNoDefaultParent io.ConfigNavCaptureKeyboard io.ConfigInputTextCursorBlink io.ConfigWindowsResizeFromEdges io.ConfigMemoryCompactTimer = 60.0 io.BackendFlags: 0x00003C1E HasMouseCursors HasSetMousePos PlatformHasViewports HasMouseHoveredViewport HasParentViewport RendererHasVtxOffset RendererHasTextures RendererHasViewports -------------------------------- io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,128 io.Fonts->FontLoaderName: stb_truetype io.DisplaySize: 1264.00,761.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 ``` ### Details: Apologies for a bit of a lazy bug-report/question. I was wondering if there is a way to detect if window is appearing from a closed state vs just becoming active (from inactive tab) ? I have mostly relied on `ImGui::IsWindowAppearing` for setting focus on widgets and doing heavy per window init work (like refreshing data for list views), but I am noticing when tabbing it triggers that logic too. I can see that it makes sense (window is appearing), but is there a way to differentiate b/w opening vs getting activated? I looked around a bit and found this issue which looks relevant (https://github.com/ocornut/imgui/issues/4177) but I am not sure if that answers my question. I can solve this issue by manual bookeeping but wanted to check if theres any better/existing solution. ### Screenshots/Video: <img width="348" height="226" alt="Image" src="https://github.com/user-attachments/assets/d01c41c2-f49d-455f-b44e-22cdcc760af3" /> ### Minimal, Complete and Verifiable Example code: ```cpp // you will have to dock this window if (ImGui::Begin("BugRepro")) { if (ImGui::IsWindowAppearing()) { // set focus to first input text when window opens ImGui::SetKeyboardFocusHere(); } static char buf1[32] = { 0 }; ImGui::InputText("Text", buf1, sizeof(buf1)); // add bloat.... ImGui::Dummy(ImVec2(0, 400.f)); static char buf2[32] = { 0 }; ImGui::InputText("SomeOtherText", buf2, sizeof(buf2)); } ImGui::End(); ```
ocornut commented 2026-09-12 16:49:10 +00:00 (Migrated from github.com)

but is there a way to differentiate b/w opening vs getting activated?

Why would you need to use that information for?
What's the actual context?

What about a docked window that's been in an unselected tab since application boot (never selected) when would it be marked as "opening" in your logic? If marked as "opening" from initial frame but not active, then widgets are supposedly not submitted and that SetKeyboardFocusHere() would never perform anything.

> but is there a way to differentiate b/w opening vs getting activated? Why would you need to use that information for? What's the actual context? What about a docked window that's been in an unselected tab since application boot (never selected) when would it be marked as "opening" in your logic? If marked as "opening" from initial frame but not active, then widgets are supposedly not submitted and that `SetKeyboardFocusHere()` would never perform anything.
ocornut commented 2026-09-12 16:49:10 +00:00 (Migrated from github.com)

but is there a way to differentiate b/w opening vs getting activated?

Why would you need to use that information for?
What's the actual context?

What about a docked window that's been in an unselected tab since application boot (never selected) when would it be marked as "opening" in your logic? If marked as "opening" from initial frame but not active, then widgets are supposedly not submitted and that SetKeyboardFocusHere() would never perform anything.

> but is there a way to differentiate b/w opening vs getting activated? Why would you need to use that information for? What's the actual context? What about a docked window that's been in an unselected tab since application boot (never selected) when would it be marked as "opening" in your logic? If marked as "opening" from initial frame but not active, then widgets are supposedly not submitted and that `SetKeyboardFocusHere()` would never perform anything.
ocornut commented 2026-09-12 16:49:10 +00:00 (Migrated from github.com)

but is there a way to differentiate b/w opening vs getting activated?

Why would you need to use that information for?
What's the actual context?

What about a docked window that's been in an unselected tab since application boot (never selected) when would it be marked as "opening" in your logic? If marked as "opening" from initial frame but not active, then widgets are supposedly not submitted and that SetKeyboardFocusHere() would never perform anything.

> but is there a way to differentiate b/w opening vs getting activated? Why would you need to use that information for? What's the actual context? What about a docked window that's been in an unselected tab since application boot (never selected) when would it be marked as "opening" in your logic? If marked as "opening" from initial frame but not active, then widgets are supposedly not submitted and that `SetKeyboardFocusHere()` would never perform anything.
amuTBKT commented 2026-09-13 02:15:34 +00:00 (Migrated from github.com)

Yeah, I think what you are saying makes sense. I feel like maybe I should refactor my setup.

For that particular code snippet should I use the p_open flag paseed to ImGui::Begin for updating keyboard focus (everytime the window opens)? ImGui::IsWindowAppearing()+ImGui::SetKeyboardFocusHere() is probably more suited for popup style windows?

Please feel free to close this as not an issue.

Yeah, I think what you are saying makes sense. I feel like maybe I should refactor my setup. For that particular code snippet should I use the `p_open` flag paseed to `ImGui::Begin` for updating keyboard focus (everytime the window opens)? `ImGui::IsWindowAppearing()`+`ImGui::SetKeyboardFocusHere()` is probably more suited for popup style windows? Please feel free to close this as not an issue.
amuTBKT commented 2026-09-13 02:15:34 +00:00 (Migrated from github.com)

Yeah, I think what you are saying makes sense. I feel like maybe I should refactor my setup.

For that particular code snippet should I use the p_open flag paseed to ImGui::Begin for updating keyboard focus (everytime the window opens)? ImGui::IsWindowAppearing()+ImGui::SetKeyboardFocusHere() is probably more suited for popup style windows?

Please feel free to close this as not an issue.

Yeah, I think what you are saying makes sense. I feel like maybe I should refactor my setup. For that particular code snippet should I use the `p_open` flag paseed to `ImGui::Begin` for updating keyboard focus (everytime the window opens)? `ImGui::IsWindowAppearing()`+`ImGui::SetKeyboardFocusHere()` is probably more suited for popup style windows? Please feel free to close this as not an issue.
amuTBKT commented 2026-09-13 02:15:34 +00:00 (Migrated from github.com)

Yeah, I think what you are saying makes sense. I feel like maybe I should refactor my setup.

For that particular code snippet should I use the p_open flag paseed to ImGui::Begin for updating keyboard focus (everytime the window opens)? ImGui::IsWindowAppearing()+ImGui::SetKeyboardFocusHere() is probably more suited for popup style windows?

Please feel free to close this as not an issue.

Yeah, I think what you are saying makes sense. I feel like maybe I should refactor my setup. For that particular code snippet should I use the `p_open` flag paseed to `ImGui::Begin` for updating keyboard focus (everytime the window opens)? `ImGui::IsWindowAppearing()`+`ImGui::SetKeyboardFocusHere()` is probably more suited for popup style windows? Please feel free to close this as not an issue.
ocornut commented 2026-09-13 07:55:19 +00:00 (Migrated from github.com)

Why would you need to use that information for? What's the actual context?

You haven’t answered the primary question so it’s difficult to give you the right answer.

For that particular code snippet should I use the p_open flag paseed to ImGui::Begin for updating keyboard focus (everytime the window opens)?

Begin() can by definition never set *p_open = true it is generally set by your app in order to trigger the control flow that will call Begin().

> Why would you need to use that information for? What's the actual context? You haven’t answered the primary question so it’s difficult to give you the right answer. > For that particular code snippet should I use the p_open flag paseed to ImGui::Begin for updating keyboard focus (everytime the window opens)? Begin() can by definition never set *p_open = true it is generally set by your app in order to trigger the control flow that will call Begin().
ocornut commented 2026-09-13 07:55:19 +00:00 (Migrated from github.com)

Why would you need to use that information for? What's the actual context?

You haven’t answered the primary question so it’s difficult to give you the right answer.

For that particular code snippet should I use the p_open flag paseed to ImGui::Begin for updating keyboard focus (everytime the window opens)?

Begin() can by definition never set *p_open = true it is generally set by your app in order to trigger the control flow that will call Begin().

> Why would you need to use that information for? What's the actual context? You haven’t answered the primary question so it’s difficult to give you the right answer. > For that particular code snippet should I use the p_open flag paseed to ImGui::Begin for updating keyboard focus (everytime the window opens)? Begin() can by definition never set *p_open = true it is generally set by your app in order to trigger the control flow that will call Begin().
amuTBKT commented 2026-09-13 10:50:14 +00:00 (Migrated from github.com)

So I have a menu bar setup like this. The "open" state of the window is only known to the menu bar container, the callback itself doesn't have any knowledge of what state the window is getting drawn from (if its opened this frame, or just activated)

// menu items are stored in the MenuBar container (name, desc, enabled flag, function to call...) 
static bool showCanvas = false;
static auto showCanvasFunc = DrawCanvasFunc;

static bool showKeyList = false;
static auto showKeyListFunc = DrawKeyListFunc;

if (ImGui::BeginMainMenuBar())
{
    // menu container ticks all the menu items and updates the show flag for windows
    if (ImGui::MenuItem("Canvas", nullptr, &showCanvas));
    if (ImGui::MenuItem("FindKeys", nullptr, &showKeyList));

    ImGui::EndMainMenuBar();
}

// show all active windows
if (showCanvas)
{
    if (ImGui::Begin("Canvas", &showCanvas))
    {
        showCanvasFunc();
    }
    ImGui::End();
}
if (showKeyList)
{
    if (ImGui::Begin("FindKeys", &showKeyList))
    {
        showKeyListFunc();
    }
    ImGui::End();
}

The callbacks use ImGui::WindowAppearing for resetting the state (not all widgets do this). The intention being that these widgets are stateless and once closed we no longer care about their state and it gets reset for next use.

auto DrawKeyListFunc = []()
    {
        static char filter[32];
        if (ImGui::IsWindowAppearing())    //<---------------------------------
        {
            filter[0] = 0;
            ImGui::SetKeyboardFocusHere(0);
        }

        ImGui::InputText("Filter", filter, sizeof(filter));
        bool filterItems = strlen(filter) > 1;
        for (int i = ImGuiKey_NamedKey_BEGIN; i < ImGuiKey_NamedKey_END; ++i)
        {
            const char* keyName = ImGui::GetKeyName((ImGuiKey)i);
            if (!filterItems || strstr(keyName, filter))
            {
                ImGui::TextUnformatted(keyName);
            }
        }
    };

auto DrawCanvasFunc = []()
    {
        static ImVector<ImVec2> points;
        static ImVec2 scrolling;
        static bool opt_enable_grid;
        static bool opt_enable_context_menu;
        static bool adding_line;

        if (ImGui::IsWindowAppearing())    //<---------------------------------
        {
            points.clear();
            scrolling = { 0.f, 0.f };
            opt_enable_grid = true;
            opt_enable_context_menu = true;
            adding_line = false;
        }

        //... rest of the function is copied from demo window
    };
Image
So I have a menu bar setup like this. The _"open"_ state of the window is only known to the menu bar container, the callback itself doesn't have any knowledge of what state the window is getting drawn from (if its opened this frame, or just activated) ```cpp // menu items are stored in the MenuBar container (name, desc, enabled flag, function to call...) static bool showCanvas = false; static auto showCanvasFunc = DrawCanvasFunc; static bool showKeyList = false; static auto showKeyListFunc = DrawKeyListFunc; if (ImGui::BeginMainMenuBar()) { // menu container ticks all the menu items and updates the show flag for windows if (ImGui::MenuItem("Canvas", nullptr, &showCanvas)); if (ImGui::MenuItem("FindKeys", nullptr, &showKeyList)); ImGui::EndMainMenuBar(); } // show all active windows if (showCanvas) { if (ImGui::Begin("Canvas", &showCanvas)) { showCanvasFunc(); } ImGui::End(); } if (showKeyList) { if (ImGui::Begin("FindKeys", &showKeyList)) { showKeyListFunc(); } ImGui::End(); } ``` The callbacks use `ImGui::WindowAppearing` for resetting the state (not all widgets do this). The intention being that these widgets are stateless and once closed we no longer care about their state and it gets reset for next use. ```cpp auto DrawKeyListFunc = []() { static char filter[32]; if (ImGui::IsWindowAppearing()) //<--------------------------------- { filter[0] = 0; ImGui::SetKeyboardFocusHere(0); } ImGui::InputText("Filter", filter, sizeof(filter)); bool filterItems = strlen(filter) > 1; for (int i = ImGuiKey_NamedKey_BEGIN; i < ImGuiKey_NamedKey_END; ++i) { const char* keyName = ImGui::GetKeyName((ImGuiKey)i); if (!filterItems || strstr(keyName, filter)) { ImGui::TextUnformatted(keyName); } } }; auto DrawCanvasFunc = []() { static ImVector<ImVec2> points; static ImVec2 scrolling; static bool opt_enable_grid; static bool opt_enable_context_menu; static bool adding_line; if (ImGui::IsWindowAppearing()) //<--------------------------------- { points.clear(); scrolling = { 0.f, 0.f }; opt_enable_grid = true; opt_enable_context_menu = true; adding_line = false; } //... rest of the function is copied from demo window }; ``` <img width="774" height="622" alt="Image" src="https://github.com/user-attachments/assets/f3aaba6f-bc92-4d07-811f-cc738f5e2877" />
amuTBKT commented 2026-09-13 10:50:14 +00:00 (Migrated from github.com)

So I have a menu bar setup like this. The "open" state of the window is only known to the menu bar container, the callback itself doesn't have any knowledge of what state the window is getting drawn from (if its opened this frame, or just activated)

// menu items are stored in the MenuBar container (name, desc, enabled flag, function to call...) 
static bool showCanvas = false;
static auto showCanvasFunc = DrawCanvasFunc;

static bool showKeyList = false;
static auto showKeyListFunc = DrawKeyListFunc;

if (ImGui::BeginMainMenuBar())
{
    // menu container ticks all the menu items and updates the show flag for windows
    if (ImGui::MenuItem("Canvas", nullptr, &showCanvas));
    if (ImGui::MenuItem("FindKeys", nullptr, &showKeyList));

    ImGui::EndMainMenuBar();
}

// show all active windows
if (showCanvas)
{
    if (ImGui::Begin("Canvas", &showCanvas))
    {
        showCanvasFunc();
    }
    ImGui::End();
}
if (showKeyList)
{
    if (ImGui::Begin("FindKeys", &showKeyList))
    {
        showKeyListFunc();
    }
    ImGui::End();
}

The callbacks use ImGui::WindowAppearing for resetting the state (not all widgets do this). The intention being that these widgets are stateless and once closed we no longer care about their state and it gets reset for next use.

auto DrawKeyListFunc = []()
    {
        static char filter[32];
        if (ImGui::IsWindowAppearing())    //<---------------------------------
        {
            filter[0] = 0;
            ImGui::SetKeyboardFocusHere(0);
        }

        ImGui::InputText("Filter", filter, sizeof(filter));
        bool filterItems = strlen(filter) > 1;
        for (int i = ImGuiKey_NamedKey_BEGIN; i < ImGuiKey_NamedKey_END; ++i)
        {
            const char* keyName = ImGui::GetKeyName((ImGuiKey)i);
            if (!filterItems || strstr(keyName, filter))
            {
                ImGui::TextUnformatted(keyName);
            }
        }
    };

auto DrawCanvasFunc = []()
    {
        static ImVector<ImVec2> points;
        static ImVec2 scrolling;
        static bool opt_enable_grid;
        static bool opt_enable_context_menu;
        static bool adding_line;

        if (ImGui::IsWindowAppearing())    //<---------------------------------
        {
            points.clear();
            scrolling = { 0.f, 0.f };
            opt_enable_grid = true;
            opt_enable_context_menu = true;
            adding_line = false;
        }

        //... rest of the function is copied from demo window
    };
Image
So I have a menu bar setup like this. The _"open"_ state of the window is only known to the menu bar container, the callback itself doesn't have any knowledge of what state the window is getting drawn from (if its opened this frame, or just activated) ```cpp // menu items are stored in the MenuBar container (name, desc, enabled flag, function to call...) static bool showCanvas = false; static auto showCanvasFunc = DrawCanvasFunc; static bool showKeyList = false; static auto showKeyListFunc = DrawKeyListFunc; if (ImGui::BeginMainMenuBar()) { // menu container ticks all the menu items and updates the show flag for windows if (ImGui::MenuItem("Canvas", nullptr, &showCanvas)); if (ImGui::MenuItem("FindKeys", nullptr, &showKeyList)); ImGui::EndMainMenuBar(); } // show all active windows if (showCanvas) { if (ImGui::Begin("Canvas", &showCanvas)) { showCanvasFunc(); } ImGui::End(); } if (showKeyList) { if (ImGui::Begin("FindKeys", &showKeyList)) { showKeyListFunc(); } ImGui::End(); } ``` The callbacks use `ImGui::WindowAppearing` for resetting the state (not all widgets do this). The intention being that these widgets are stateless and once closed we no longer care about their state and it gets reset for next use. ```cpp auto DrawKeyListFunc = []() { static char filter[32]; if (ImGui::IsWindowAppearing()) //<--------------------------------- { filter[0] = 0; ImGui::SetKeyboardFocusHere(0); } ImGui::InputText("Filter", filter, sizeof(filter)); bool filterItems = strlen(filter) > 1; for (int i = ImGuiKey_NamedKey_BEGIN; i < ImGuiKey_NamedKey_END; ++i) { const char* keyName = ImGui::GetKeyName((ImGuiKey)i); if (!filterItems || strstr(keyName, filter)) { ImGui::TextUnformatted(keyName); } } }; auto DrawCanvasFunc = []() { static ImVector<ImVec2> points; static ImVec2 scrolling; static bool opt_enable_grid; static bool opt_enable_context_menu; static bool adding_line; if (ImGui::IsWindowAppearing()) //<--------------------------------- { points.clear(); scrolling = { 0.f, 0.f }; opt_enable_grid = true; opt_enable_context_menu = true; adding_line = false; } //... rest of the function is copied from demo window }; ``` <img width="774" height="622" alt="Image" src="https://github.com/user-attachments/assets/f3aaba6f-bc92-4d07-811f-cc738f5e2877" />
ocornut commented 2026-09-14 12:57:20 +00:00 (Migrated from github.com)

In your specific case you could in theory attempt to pass a reset signal to your tools.
Differentiating both cases is an interesting topic. If I grep for Appearing it's used for a few other things and particularly default scrolling behavior for focus functions.

It seems like there are related issues #4177, #2283 open.
Ref this was added in 91704b77 with amends in f03ab2a5c.
Will need to investigate further.

In your specific case you could in theory attempt to pass a reset signal to your tools. Differentiating both cases is an interesting topic. If I grep for `Appearing` it's used for a few other things and particularly default scrolling behavior for focus functions. It seems like there are related issues #4177, #2283 open. Ref this was added in 91704b77 with amends in f03ab2a5c. Will need to investigate further.
ocornut commented 2026-09-14 12:57:20 +00:00 (Migrated from github.com)

In your specific case you could in theory attempt to pass a reset signal to your tools.
Differentiating both cases is an interesting topic. If I grep for Appearing it's used for a few other things and particularly default scrolling behavior for focus functions.

It seems like there are related issues #4177, #2283 open.
Ref this was added in 91704b77 with amends in f03ab2a5c.
Will need to investigate further.

In your specific case you could in theory attempt to pass a reset signal to your tools. Differentiating both cases is an interesting topic. If I grep for `Appearing` it's used for a few other things and particularly default scrolling behavior for focus functions. It seems like there are related issues #4177, #2283 open. Ref this was added in 91704b77 with amends in f03ab2a5c. Will need to investigate further.
amuTBKT commented 2026-09-14 23:59:26 +00:00 (Migrated from github.com)

I think I will probably have to add a "WindowClosed" callback to handle the cleanup.
Thanks for the help!

Feel free to the mark the issue resolved/closed

I think I will probably have to add a "WindowClosed" callback to handle the cleanup. Thanks for the help! <sup>Feel free to the mark the issue resolved/closed</sup>
amuTBKT commented 2026-09-14 23:59:26 +00:00 (Migrated from github.com)

I think I will probably have to add a "WindowClosed" callback to handle the cleanup.
Thanks for the help!

Feel free to the mark the issue resolved/closed

I think I will probably have to add a "WindowClosed" callback to handle the cleanup. Thanks for the help! <sup>Feel free to the mark the issue resolved/closed</sup>
ocornut commented 2026-09-15 14:49:27 +00:00 (Migrated from github.com)

I think I will probably have to add a "WindowClosed" callback to handle the cleanup.

A callback or stored state/signal on your end would work.

A undocumented alternative would be, e.g.

if (ImGuiWindow* window = ImGui::FindWindowByName(name))
   if (!window->Active && window->WasActive)
        do_stuff();
> I think I will probably have to add a "WindowClosed" callback to handle the cleanup. A callback or stored state/signal on your end would work. A undocumented alternative would be, e.g. ```cpp if (ImGuiWindow* window = ImGui::FindWindowByName(name)) if (!window->Active && window->WasActive) do_stuff(); ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#9542
No description provided.