mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-01 05:10:41 +00:00
How do I select Reordable Tab? #5853
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#5853
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have 4 tabs using ImGui::BeginTabItem.
I am using ImGuiTabBarFlags_Reorderable flag for ImGui::BeginTabBar.
I want to select the tab next to the currently selected tab, how do I do that?
I know I can select tab by using ImGuiTabItemFlags_SetSelected, but I don't know which tab is NEXT for because I can't get the order of Reorderable tabs.
This is not supported by the API and seems like an odd request to want to select the tab right of current tab while allowing user re-ordering. Can you explain more of the context?
The ImGUI Window I create is used by many users.
The four tabs (In fact, many more tabs) have different priorities for each user and I want to make Reordable so that it is easy for them to use.
I assume they will change the order of the tabs by using the mouse.
Apart from that, I have a request to control ImGUI Window with something other than a mouse (keyboard or gamepad) from them.
I try to fulfill this request with my program, but I am stuck with the problem that when change the selection of tabs with the keyboard, I don't know in which order the tabs are arranged, so I don't even know which tab is to the right of the current tab.
You did not answer my question, why would you want to care about the tab on the right if the tabs are reorderable?
I am not grasping the intent of your question.
There are some users who can't write (and read) programs.
When they run the above code, the tabs line up in the following order.
User1 only uses Tab2 and Tab3, so they are reordered as follows
User2 uses only Tab1 and Tab4, so they are reordered as follows
The work up to this point is done using the mouse.
As I mentioned earlier, We want to use the keyboard or gamepad to control the GUI for any further operations.
When we type the command "move to next tab" on the keyboard, We want to select tabs in the order we see them visually.
No one knows the order of the tabs for User1 and User2 except ImGui.
Even if I know that the current tab is Tab1 , I can't know whether Tab2, Tab3, or Tab4 is next to Tab1.
Is it possible to control ImGui with keyboard if I just don't know about it?
My question was asking why one would want “go to next tab” in the place. We can’t answer questions without understanding intent.
If you dig in internals you’ll easily find tab order data (its also exposed in Debugger/Metrics where you can see how to access it).
Keyboard/Gamepad Navigation config flags allows controls of dear imgui.
@isringo See this FAQ entry for details on keyboard/gamepad navigation.
Thank you. I'll look it.
Sorry for my late answer. And I forgot to acknowledge that last "long message" gave me the information I wanted to understand your use case. I have pushed a bunch of low-level/internal helpers in
3d8885cwhich should now make it possible to do that work with a sensibly more stable and documented API."Move to next tab" therefore should be something along the line of: