Browse Source

InputScalar: added an assert to clarify that ImGuiInputTextFlags_EnterReturnsTrue is not supported by InputFloat, InputInt etc. (#8065)

It was never correctly supported. Please open an issue if you this would be useful to you. Otherwise use IsItemDeactivatedAfterEdit().
ocornut 10 tháng trước cách đây
mục cha
commit
604f2fa84a
2 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 2 0
      docs/CHANGELOG.txt
  2. 1 0
      imgui_widgets.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -93,6 +93,8 @@ Other changes:
   preventing use of external shortcuts not guarded by an ActiveId check. (#8048) [@geertbleyen]
   preventing use of external shortcuts not guarded by an ActiveId check. (#8048) [@geertbleyen]
 - InputText: ensure mouse cursor shape is set regardless of whether keyboard mode is 
 - InputText: ensure mouse cursor shape is set regardless of whether keyboard mode is 
   enabled or not. (#6417)
   enabled or not. (#6417)
+- InputScalar: added an assert to clarify that ImGuiInputTextFlags_EnterReturnsTrue is not
+  supported by InputFloat, InputInt, InputScalar etc. widgets. It actually never was. (#8065)
 - imgui_freetype: Added support for plutosvg (as an alternative to lunasvg) to render 
 - imgui_freetype: Added support for plutosvg (as an alternative to lunasvg) to render 
   OpenType SVG fonts. Requires defining IMGUI_ENABLE_FREETYPE_PLUTOSVG along with IMGUI_ENABLE_FREETYPE.
   OpenType SVG fonts. Requires defining IMGUI_ENABLE_FREETYPE_PLUTOSVG along with IMGUI_ENABLE_FREETYPE.
   Providing headers/librairies for plutosvg + plutovg is up to you (see #7927 for help).
   Providing headers/librairies for plutosvg + plutovg is up to you (see #7927 for help).

+ 1 - 0
imgui_widgets.cpp

@@ -3656,6 +3656,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
 
 
     ImGuiContext& g = *GImGui;
     ImGuiContext& g = *GImGui;
     ImGuiStyle& style = g.Style;
     ImGuiStyle& style = g.Style;
+    IM_ASSERT((flags & ImGuiInputTextFlags_EnterReturnsTrue) == 0); // Not supported by InputScalar(). Please open an issue if you this would be useful to you. Otherwise use IsItemDeactivatedAfterEdit()!
 
 
     if (format == NULL)
     if (format == NULL)
         format = DataTypeGetInfo(data_type)->PrintFmt;
         format = DataTypeGetInfo(data_type)->PrintFmt;