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

BeginTabItem() ignores flags if p_open == nil #4088

Open
ESV-Sweetplum opened this issue Apr 26, 2024 · 1 comment
Open

BeginTabItem() ignores flags if p_open == nil #4088

ESV-Sweetplum opened this issue Apr 26, 2024 · 1 comment
Labels

Comments

@ESV-Sweetplum
Copy link

Describe the bug

When a tab item is created, there are times when you want to use a flag to override selection. However, in Quaver, this is only possible when p_open = true or p_open = false, both of which are not ideal:

  • p_open = true creates x's on the tab items
  • p_open = false just removes the tab entirely

When p_open = nil, the flags are ignored.

To Reproduce

  1. Create a new plugin with whatever settings.ini you'd like.
  2. Add the following to plugin.lua:
function draw()
    imgui.Begin("hi")

    imgui.BeginTabBar("the tab bar of all time")

    if imgui.BeginTabItem("item 1") then
        imgui.EndTabItem()
    end

    if imgui.BeginTabItem("item 2", nil, imgui_tab_item_flags.SetSelected) then
        imgui.EndTabItem()
    end

    if imgui.BeginTabItem("item 3") then
        imgui.EndTabItem()
    end


    imgui.EndTabBar()

    imgui.End()
end
  1. Notice that item 2 is not always selected.

Expected behavior

Expected behavior occurs when the nil is replaced to true within the second imgui.BeginTabItem():

function draw()
    imgui.Begin("hi")

    imgui.BeginTabBar("the tab bar of all time")

    if imgui.BeginTabItem("item 1") then
        imgui.EndTabItem()
    end

    if imgui.BeginTabItem("item 2", true, imgui_tab_item_flags.SetSelected) then
        imgui.EndTabItem()
    end

    if imgui.BeginTabItem("item 3") then
        imgui.EndTabItem()
    end


    imgui.EndTabBar()

    imgui.End()
end

Log Files

Quaver does not produce plugin logs.

Screenshots

When item 2 has p_open = true:
image

In the above image, it is impossible to select another tab, which is the intended behavior of the code above.

When item 2 has p_open = nil:
image

Notice that item 1 being selected completely violates the code, as it mandates that item 2 be selected at all times. This is the core error.

@ESV-Sweetplum
Copy link
Author

Also, if it's possible, please update imgui.NET to the latest release. The current version being used by Quaver is 1.67.0, which is 5 years old. (Source: Quaver_Secure/Quaver.deps.json)

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

1 participant