mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-01 05:10:41 +00:00
Getting index of the TabItem #5997
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#5997
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?
Hey, is there any way how could I get the current index of element in BeginTabBar/EndTabBar while having enabled ImGuiTabBarFlags_Reorderable? Was browsing the demo, but sadly didn't find anything related to that. Thanks for any answers.
Edit:
After some checking of the implementation of the TabItems, I found out I can write something like this and so far looks like it does what I was looking for. Gonna leave it here in case someone else will need it.
Also see #5853
It seems odd to me that you would want this index. For which purpose would you use it ?
It's for my small VFX editor, where each tab is VFX object (and its properties), so for my usage, it's more convenient to move the order of objects (which matters) using the ImGuiTabBarFlags_Reorderable. I understand it's probably not made for those use cases, but for me, it's good enough atm. Anyway if you have any tips, they're more than welcome.
I don’t understand your explanation but I am interested to understand this better. Could you clarify?
If there is a use case, I can consider improving the public API. Thank you!
Well, I'll give a different example of a use-case. When you have in Chrome opened multiple tabs, you can right-click one of the tabs and click
close all the tabs on the right sidefrom the tab you've clicked. In that case you need to somehow keep a track of the order of the windows. Should make more sense as an example.Here is how it could be handled using the GetTabItemIndex function.
Sorry for my late answer, I have now pushed
3d8885cwith a handful of internal/low-level helpers to facilitate this.It may little more mouthful as I didn't want to add extraneous/unnecessary helpers, but something like this should work: