InputInt/InputFloat: When used with Steps values and _ReadOnly flag, the step button look disabled. (#211)

This commit is contained in:
ocornut 2021-07-09 19:02:48 +02:00
parent 97638bf977
commit f6682404e1
2 changed files with 4 additions and 1 deletions

View File

@ -52,6 +52,7 @@ Other Changes:
- Tables: Fix columns order on TableSetupScrollFreeze() if previous data got frozen columns out of their section. - Tables: Fix columns order on TableSetupScrollFreeze() if previous data got frozen columns out of their section.
- Tables: Fix invalid data in TableGetSortSpecs() when SpecsDirty flag is unset. (#4233) - Tables: Fix invalid data in TableGetSortSpecs() when SpecsDirty flag is unset. (#4233)
- TabBar: Fixed using more than 32 KB-worth of tab names. (#4176) - TabBar: Fixed using more than 32 KB-worth of tab names. (#4176)
- InputInt/InputFloat: When used with Steps values and _ReadOnly flag, the step button look disabled. (#211)
- Drag and Drop: drop target highlight doesn't try to bypass host clipping rectangle. (#4281, #3272) - Drag and Drop: drop target highlight doesn't try to bypass host clipping rectangle. (#4281, #3272)
- Menus: MenuItem() and BeginMenu() are not affected/overlapping when style.SelectableTextAlign is altered. - Menus: MenuItem() and BeginMenu() are not affected/overlapping when style.SelectableTextAlign is altered.
- Nav: Disabled items are not candidate for default focus. (#211, #787) - Nav: Disabled items are not candidate for default focus. (#211, #787)

View File

@ -3444,7 +3444,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
style.FramePadding.x = style.FramePadding.y; style.FramePadding.x = style.FramePadding.y;
ImGuiButtonFlags button_flags = ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups; ImGuiButtonFlags button_flags = ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups;
if (flags & ImGuiInputTextFlags_ReadOnly) if (flags & ImGuiInputTextFlags_ReadOnly)
button_flags |= ImGuiButtonFlags_Disabled; PushDisabled(true);
SameLine(0, style.ItemInnerSpacing.x); SameLine(0, style.ItemInnerSpacing.x);
if (ButtonEx("-", ImVec2(button_size, button_size), button_flags)) if (ButtonEx("-", ImVec2(button_size, button_size), button_flags))
{ {
@ -3457,6 +3457,8 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
DataTypeApplyOp(data_type, '+', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step); DataTypeApplyOp(data_type, '+', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step);
value_changed = true; value_changed = true;
} }
if (flags & ImGuiInputTextFlags_ReadOnly)
PopDisabled();
const char* label_end = FindRenderedTextEnd(label); const char* label_end = FindRenderedTextEnd(label);
if (label != label_end) if (label != label_end)