You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the later discussion in #2006, would it be possible to change the return behaviour of some widgets with something like PushStyleVar?
Say if you did ImGui::PushBehaviour(ReturnBehaviourFlags_ReturnTrueOnChange) it made widgets return true every change, but ImGui::PushBehaviour(ReturnBehaviourFlags_ReturnTrueOnComplete) made them only return true when the user is finished modifying the value. This method could reduce the number of flags needed for each widget type and possibly remove the need for IsItemDeactivatedAfterEdit().
It might also be interesting to use this to change how and when values are written out from their buffers, potentially reducing the number of resize() calls in the std::string version of ImGui::InputText
The text was updated successfully, but these errors were encountered:
OK you are slightly diverging from the thing discussed in #2006.
There are multiple topics there:
Let's focus on the needs rather than building an issue out of a hypothetical API call.
As I pointed out in Allow for dynamic re-allocation of internal buffer while user is still typing in InputText? #2006, this may working for you only because you have an (unnecessary, but here happens to be helpful) indirection and sync between your data and the imgui data handled by imgui. The fundamental design of dear imgui revolve around removing those duplication/sync. And you probably don't have this indirection for all your widgets, so how would ReturnBehaviourFlags_ReturnTrueOnComplete effectively be useful and meaningful when you are editing Checkbox, Integers etc where the underlying value is already modified while editing?
Suggesting a global all-items flags is much more work that supporting it for InputText(). A) IsItemDeactivatedAfterEdit() is a costlier function and B) we currently can't guarantee it works with every use case.
The idea needs to be supported with more examples. Right now your stance is "it is annoying to call IsItemDeactivatedAfterEdit() I want it by default everywhere" can you support that claim with more examples than InputText and how it would work? (Remember that the definition you are asking for is not correlated to the writing back of value)
It might also be interesting to use this to change how and when values are written out from their buffers, potentially reducing the number of resize() calls in the std::string version of ImGui::InputText
There's two different things here. A) Reducing the number of resize() is a non-issue, you have a user callback and you are free to reserve ahead if you need. B) The timing of writing back out to the user's buffer is the topic in #701 I agree it's an important/useful feature and I agree there's overlap between that and this topic hypothetical ReturnBehaviourFlags_ReturnTrueOnComplete, perhaps there's a single behavior enum that encompass both strategy.
Version/Branch of Dear ImGui:
1.64
As per the later discussion in #2006, would it be possible to change the return behaviour of some widgets with something like PushStyleVar?
Say if you did
ImGui::PushBehaviour(ReturnBehaviourFlags_ReturnTrueOnChange)
it made widgets return true every change, butImGui::PushBehaviour(ReturnBehaviourFlags_ReturnTrueOnComplete)
made them only return true when the user is finished modifying the value. This method could reduce the number of flags needed for each widget type and possibly remove the need forIsItemDeactivatedAfterEdit()
.It might also be interesting to use this to change how and when values are written out from their buffers, potentially reducing the number of
resize()
calls in thestd::string
version ofImGui::InputText
The text was updated successfully, but these errors were encountered: