-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Method to dynamically change Hide/Show Column in Tables (request and fix suggested) #3935
Comments
Hello,
Question 1: are you aware that user can right-click to alter visibility of individual columns, or reset visibility state? Question 2: if you answered Yes to question 1, why do you need to alter it programmatically? Please be explicit. There is a function |
I upvote to make TableSetColumnEnabled public. |
Good points.
Why not just including imgui_internal.h in the one file that needs it? |
I'm trying to use the standard API as much as possible :) |
Hello Short: Long:
I get your point now.
No, I was not, and yes in order for right click to work I need to remove my code. :-)
Q1 answer is No. But nevertheless I need(ed) a way to programmatically hide/show column with a Boolean preset In fact the demo show exactly what I need, in Table&Columns->Column flags->check box "_DefaultHide" of column Two Of course I can have various Table layouts, but it lack elegance and increase dramatically the amount of code for us, Note: Thanks |
I agree with you, but the feature worth breaking the law but not the rule ;-)
|
Added |
…use the ImGuiTableFlags_Hideable flag. (#3935)
The flag ImGuiTableColumnFlags_DefaultHide does hide a column but once and for all
because it is only used on first call to TableSetupColumn(...) where a few line are executed but only under control of
table->IsInitializing
so this happens only on first call.This behavior prevent the capabilities to hide the column at will. (after first Frame on the table).
Maybe a flag allow it but not only didn't I find it but vanillia demo show this strange behavior on code related to “
ImGui::TreeNode("Columns flags")
” where in the list of flags manage trough check box , the “hide” in fact do nothing.But the example in table
ImGui::TreeNode("Resizable, mixed")
does properly hide column "CCC" of "table2"The reason underneath the lack of "dynamic" (that it cannot change on each frame) is due to the State of a Table flag
table->IsInitializing
which is kept at true until first call toEndTable ()
where it is set forever at “false”.However it seems making sense to keep this feature more dynamic in
ImGui::TableSetupColumn()
where this flag does manage display.Workaround:
Add management code for column->IsEnabled = column->IsEnabledNextFrame = true in ImGui::TableSetupColumn
See below
Drawback:
Unknown why the implementation work that way. Maybe the code does what it is intended to do.
Effect of the 2 flags involved are not fully understood, but so far no side effect seen.
The check is done on
flags
but after it is filtered and == tocolumn->Flags
. (see full source to clarify)This is my choice to respect the sequence used in
if (table->IsInitializing)
but it would be good to dig in BeginTable and see how much code is executed to seeif a transient Method should be designed (use of only one flag ? column->IsEnabledNextFrame? )(WIP v1.82) Docking branch
imgui_table.cpp ~ line 1387
Standard code
Extended Code
The text was updated successfully, but these errors were encountered: