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

ImGuiSelectableFlags_SpanAllColumns do not span whole table if ImGuiTableFlags_ScrollFreezeLeftColumn set and scrolled horizontally to the right #3386

Closed
jpbrault opened this issue Aug 5, 2020 · 2 comments

Comments

@jpbrault
Copy link

jpbrault commented Aug 5, 2020

Version/Branch of Dear ImGui:

Version: 1.78 WIP
Branch: table

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_sdl.cpp + imgui_impl_opengl2.cpp
Compiler: GCC 9.1 / Clang 10
Operating System: Mac/Linux

My Issue/Question:

When using a Selectable() in a table row with the ImGuiSelectableFlags_SpanAllColumns flag in a table with ImGuiTableFlags_ScrollFreezeTopRow | ImGuiTableFlags_Scroll | ImGuiTableFlags_ScrollFreezeLeftColumn flags, I would expect the selection to extent past the last column so the whole row would be selected/highlighted. I would also expect that column highlight to header to align with the cell.

Screenshots/Video

scroll1
scroll2
scroll3
scroll3
scroll4
scroll5
scroll6

  if ( ImGui::Begin( "Window" ) )
  {
    if ( ImGui::BeginTable(
         "Table", 2,
            ImGuiTableFlags_ScrollFreezeTopRow |
           ImGuiTableFlags_Scroll |
           ImGuiTableFlags_ScrollFreezeLeftColumn ) )
    {
      ImGui::TableSetupColumn(
        "Col 1", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHide,
        200 );
      ImGui::TableSetupColumn(
        "Col 2", ImGuiTableColumnFlags_WidthFixed,
        200 );
      ImGui::TableAutoHeaders();

      ImGui::TableNextRow();
      ImGui::TableSetColumnIndex( 0 );

      ImGui::Selectable( "Val 1", true,
                         ImGuiSelectableFlags_SpanAllColumns |
                          ImGuiSelectableFlags_AllowDoubleClick );
      if ( ImGui::TableNextCell() )
        ImGui::TextUnformatted( "Val 2");

      ImGui::EndTable();
    }
    ImGui::End();
  }
@ocornut
Copy link
Owner

ocornut commented Aug 5, 2020

Hello and thanks for the report.
I believe this is merely a variant of the issue described in #3187.
Going to look at that more seriously.

ocornut added a commit that referenced this issue Aug 5, 2020
…lling (in or outside columns). (#3187, #3386)

# Conflicts:
#	imgui_widgets.cpp
@ocornut
Copy link
Owner

ocornut commented Aug 5, 2020

This should now be fixed in master by 8074b49 and in tables with 8074b49.

Thanks for your help and report!

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

No branches or pull requests

2 participants