Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table inside Child do not save their column layout #3367

Closed
jpbrault opened this issue Jul 28, 2020 · 2 comments
Closed

Table inside Child do not save their column layout #3367

jpbrault opened this issue Jul 28, 2020 · 2 comments
Labels

Comments

@jpbrault
Copy link

Version/Branch of Dear ImGui:

Version: 1.78 WIP / 17703
Branch: table

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_opengl2.cpp + imgui_impl_sdl.cpp

My Issue/Question:

I have a table inside a child block that I would like to have it column layout to be saved in the ini file.

  const auto footerHeight = ImGui::GetTextLineHeightWithSpacing() + 5.0f;
  if ( ImGui::BeginChild( "Child", ImVec2{ 0, - footerHeight } ) )
  {
    if ( ImGui::BeginTabBar( "TabBar" ) )
    {
      if ( ImGui::BeginTabItem( "Table" ) )
      {
        if ( ImGui::BeginTable( "Table", 2, ImGuiTableFlags_Reorderable | ImGuiTableFlags_Resizable, ImVec2{ 0, 0 } ) )
        {
          ImGui::TableSetupColumn( "Col1" );
          ImGui::TableSetupColumn( "Col2" );
          ImGui::TableAutoHeaders();
          ImGui::EndTable();
        }
        ImGui::EndTabItem();
      }
      if ( ImGui::BeginTabItem( "Not Table" ) )
      {
        ImGui::EndTabBar();
      }
      ImGui::EndTabItem();
    }
    ImGui::EndChild();
  }
  ImGui::Text("Footer");
  ImGui::End();

This is not working because the BeginChild have implicitly the ImGuiWindowFlags_NoSavedSettings.

Adding the following line after the BeginChild() work around the problem.

ImGui::GetCurrentWindow()->Flags &= ~ImGuiWindowFlags_NoSavedSettings;

@ocornut ocornut added tables/columns settings .ini persistance labels Jul 28, 2020
@ocornut
Copy link
Owner

ocornut commented Jul 28, 2020

Makes sense, thanks for pointing this out! I'll be looking for a solution for this (while keeping child window data themselves unsaved).

@ocornut
Copy link
Owner

ocornut commented Aug 10, 2020

Pushed a fix for this, see 7bf78c6
Thanks for reporting!

(Fix reminds me I want to do some work on this RootWindow/RootWindowDockStop thing in docking branch.. )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants