mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 21:21:06 +01:00 
			
		
		
		
	Fixed using IsItemEdited() after Combo() not matching the return value from Combo(). (#2034) + fix some PVS warnings, fix typo, blanks.
Amend e28b1078
			
			
This commit is contained in:
		| @@ -1976,18 +1976,18 @@ static void ShowDemoWindowWidgets() | ||||
|         ImGui::TreePop(); | ||||
|     } | ||||
|  | ||||
|     if (ImGui::TreeNode("Querying Status (Active/Focused/Hovered etc.)")) | ||||
|     if (ImGui::TreeNode("Querying Status (Edited/Active/Focused/Hovered etc.)")) | ||||
|     { | ||||
|         // Select an item type | ||||
|         const char* item_names[] = | ||||
|         { | ||||
|             "Text", "Button", "Button (w/ repeat)", "Checkbox", "SliderFloat", "InputText", "InputFloat", | ||||
|             "InputFloat3", "ColorEdit4", "MenuItem", "TreeNode", "TreeNode (w/ double-click)", "ListBox" | ||||
|             "InputFloat3", "ColorEdit4", "MenuItem", "TreeNode", "TreeNode (w/ double-click)", "Combo", "ListBox" | ||||
|         }; | ||||
|         static int item_type = 1; | ||||
|         ImGui::Combo("Item Type", &item_type, item_names, IM_ARRAYSIZE(item_names), IM_ARRAYSIZE(item_names)); | ||||
|         ImGui::SameLine(); | ||||
|         HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions."); | ||||
|         HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered()."); | ||||
|  | ||||
|         // Submit selected item item so we can query their status in the code following it. | ||||
|         bool ret = false; | ||||
| @@ -2006,7 +2006,8 @@ static void ShowDemoWindowWidgets() | ||||
|         if (item_type == 9) { ret = ImGui::MenuItem("ITEM: MenuItem"); }                                // Testing menu item (they use ImGuiButtonFlags_PressedOnRelease button policy) | ||||
|         if (item_type == 10){ ret = ImGui::TreeNode("ITEM: TreeNode"); if (ret) ImGui::TreePop(); }     // Testing tree node | ||||
|         if (item_type == 11){ ret = ImGui::TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_NoTreePushOnOpen); } // Testing tree node with ImGuiButtonFlags_PressedOnDoubleClick button policy. | ||||
|         if (item_type == 12){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); } | ||||
|         if (item_type == 12){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); } | ||||
|         if (item_type == 13){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); } | ||||
|  | ||||
|         // Display the values of IsItemHovered() and other common item state functions. | ||||
|         // Note that the ImGuiHoveredFlags_XXX flags can be combined. | ||||
| @@ -6043,7 +6044,7 @@ struct ExampleAppConsole | ||||
|     // Portable helpers | ||||
|     static int   Stricmp(const char* s1, const char* s2)         { int d; while ((d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; } return d; } | ||||
|     static int   Strnicmp(const char* s1, const char* s2, int n) { int d = 0; while (n > 0 && (d = toupper(*s2) - toupper(*s1)) == 0 && *s1) { s1++; s2++; n--; } return d; } | ||||
|     static char* Strdup(const char* s)                           { size_t len = strlen(s) + 1; void* buf = malloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)s, len); } | ||||
|     static char* Strdup(const char* s)                           { IM_ASSERT(s); size_t len = strlen(s) + 1; void* buf = malloc(len); IM_ASSERT(buf); return (char*)memcpy(buf, (const void*)s, len); } | ||||
|     static void  Strtrim(char* s)                                { char* str_end = s + strlen(s); while (str_end > s && str_end[-1] == ' ') str_end--; *str_end = 0; } | ||||
|  | ||||
|     void    ClearLog() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user