-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
ImGuiListClipper.ForceDisplayRangeByIndices() documentation slightly misleading. #6424
Comments
Yes, I can see how the "Display" in the Name can be misleading. A more appropriate name might be f.e. "IncludeRangeByIndices" (with the old name wrapping to the new one for compatibility, but marked as obsolete). If there is any renaming, I would suggest renaming the parameters to "item_begin" and "item_end" as well, since those are known widely from the STL and "end" is always excluded from the range, while "max" usually implies inclusion. I originally needed to extend the list clipper for correct display of drag&drop information, even with items not displayed. |
I agree with this. Renaming the function and parameters would be good too. |
You are right. (Linking to #3841 for future ref) |
Pushed ecb0aaa, thanks both! |
Thanks. just took a look at the commit and noticed a few minor things... Parameter inconsistency: Copy & paste errors or typos in CHANGELOG.txt:
|
Thank you Daniel (that'll teach me for committing hastily before going to lunch). I've amended this with e489e40 and took the liberty to attribute you the commit. |
What do you think about updating the comment too? I think the comment is alluding to the old name. Slighly modifying the comment I suggested above to be more in line with the current comment, it could be more verbose like so: // Call IncludeRangeByIndices() before first call to Step() if you need a range of items to be included inside one of the calls to Step() regardless of visibility.
IMGUI_API void IncludeRangeByIndices(int item_begin, int item_end); // item_end is exclusive e.g. use (42, 42+1) to make item 42 always visible BUT due to alignment/padding of certain items it is possible/likely that an extra item may be included on either end of the display range. |
I'll further tweak the comment in a future commit, thanks. |
I have made two changes to those API now:
|
Version/Branch of Dear ImGui:
Version: 1.89.6 WIP (18954)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
My Issue/Question:
Hi Team. While looking to create a binding on top of
dear_bindings
I've been trying to create my own testing window similar to ShowDemoWindow, but in the binding language. This process involves wrapping a function and then looking for a way to implement the function to ensure the binding works. The actual code I'm running is thedear_bindings
C version in the minimal example. This issue does not regarddear_bindings
, but rather ImGui's documentation. This detail has been included for transparency.The function this issue regards is:
imgui.h
The documentation seems to imply that this function is forcing a specific range of items to be displayed (as in visible)? If you test that theory, it is incorrect. Based Upon GamingMinds-DanielC's minimal example from (the unfortunately hard to read) #5995 (working below):
We can see that what it actually does is force those indices to appear inside a call to
clipper.Step()
. This doesn't necessarily mean that those indices are visible. The example above shows this if you comment-out theSetScrollHereY
. WithoutForceDisplayRangeByIndices
the call toSetScrollHereY
never happens. My suggestion is to be more clear inside the documentation for anyone looking to use the function. The function is also not used in ShowDemoWindow so the comment andimgui.cpp
is all we have.I suggest an updated comment similar to:
imgui.h
Or, I think it would be great if Daniel's example were added to the Demo Window to demonstrate the function's uses.
Maybe this is my lack of understanding regarding the terminolgy of "displayed" in ImGui.
This has been opened as an issue because I believe the current comment is a little confusing and hopefully will serve as a helper for others in the future regardless if the suggestion is adopted.
The text was updated successfully, but these errors were encountered: