From 3732ac332f61da69b0214ecefb106df8626d575f Mon Sep 17 00:00:00 2001 From: Cara Date: Fri, 12 Mar 2021 16:28:36 +1030 Subject: [PATCH] Fix copy buttons in data window not working due to conflicting Ids ImGui really sucks at this --- Dalamud/Interface/DalamudDataWindow.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dalamud/Interface/DalamudDataWindow.cs b/Dalamud/Interface/DalamudDataWindow.cs index 3899697bc..cc4b0ad8b 100644 --- a/Dalamud/Interface/DalamudDataWindow.cs +++ b/Dalamud/Interface/DalamudDataWindow.cs @@ -42,6 +42,8 @@ namespace Dalamud.Interface private UIDebug UIDebug = null; + private uint copyButtonIndex = 0; + public DalamudDataWindow(Dalamud dalamud) { this.dalamud = dalamud; @@ -57,6 +59,7 @@ namespace Dalamud.Interface } public bool Draw() { + this.copyButtonIndex = 0; ImGui.SetNextWindowSize(new Vector2(500, 500), ImGuiCond.FirstUseEver); var isOpen = true; @@ -101,7 +104,7 @@ namespace Dalamud.Interface } ImGui.Text($"Result: {this.sigResult.ToInt64():X}"); ImGui.SameLine(); - if (ImGui.Button("C")) { + if (ImGui.Button($"C{this.copyButtonIndex++}")) { ImGui.SetClipboardText(this.sigResult.ToInt64().ToString("x")); } @@ -112,7 +115,7 @@ namespace Dalamud.Interface $" {valueTuple.Item1} - 0x{valueTuple.Item2.ToInt64():x}"); ImGui.SameLine(); - if (ImGui.Button("C")) { + if (ImGui.Button($"C##copyAddress{copyButtonIndex++}")) { ImGui.SetClipboardText(valueTuple.Item2.ToInt64().ToString("x")); } } @@ -427,7 +430,7 @@ namespace Dalamud.Interface ImGui.TextUnformatted(actorString); ImGui.SameLine(); - if (ImGui.Button("C")) { + if (ImGui.Button($"C##{this.copyButtonIndex++}")) { ImGui.SetClipboardText(actor.Address.ToInt64().ToString("X")); }