fix: clear button on rightside of the search bar when its dirty

This commit is contained in:
Vati
2026-03-10 20:31:24 +04:00
parent ccb1d564f6
commit 1eebc25307
5 changed files with 63 additions and 25 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: Guda
## Notes: All-in-one bag and bank addon for World of Warcraft 1.12.1 (Turtle WoW)
## Author: Vati
## Version: 2.0.6
## Version: 2.0.7
## SavedVariables: Guda_DB
## SavedVariablesPerCharacter: Guda_CharDB
+3
View File
@@ -234,6 +234,9 @@ function Guda_BagFrame_OnHide(self)
-- Hide tooltip (it may be showing for soul bag or other footer buttons)
GameTooltip:Hide()
-- Clear search field
Guda_BagFrame_ClearSearch()
-- Clear any pending update and work queue items
pendingUpdate = false
if addon.Modules.Utils and addon.Modules.Utils.ClearWorkQueue then
+28 -12
View File
@@ -679,7 +679,7 @@
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="40" y="0"/>
<AbsDimension x="16" y="0"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
@@ -712,6 +712,16 @@
</OnEditFocusLost>
<OnTextChanged>
Guda_BagFrame_OnSearchChanged(this)
-- Show/hide clear button based on search content
local clearBtn = getglobal("Guda_BagFrame_SearchBar_ClearButton")
if clearBtn then
local text = this:GetText()
if text ~= "" and text ~= "Search, try ~equipment" then
clearBtn:Show()
else
clearBtn:Hide()
end
end
</OnTextChanged>
<OnEscapePressed>
this:SetText("Search, try ~equipment")
@@ -723,31 +733,37 @@
</EditBox>
<!-- Clear Search Button -->
<Button name="$parent_ClearButton">
<Button name="$parent_ClearButton" hidden="true">
<Size>
<AbsDimension x="26" y="26"/>
<AbsDimension x="12" y="12"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Anchor point="RIGHT" relativeTo="$parent_SearchBox" relativePoint="RIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
<AbsDimension x="-5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Up"/>
<PushedTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Down"/>
<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD"/>
<NormalTexture file="Interface\AddOns\Guda\Assets\close"/>
<Scripts>
<OnLoad>
local searchBox = getglobal("Guda_BagFrame_SearchBar_SearchBox")
if searchBox then
this:SetFrameLevel(searchBox:GetFrameLevel() + 1)
end
local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.4, 0.4, 0.4) end
</OnLoad>
<OnClick>
Guda_BagFrame_ClearSearch()
</OnClick>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_TOP")
GameTooltip:SetText("Clear search bar")
GameTooltip:Show()
local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.7, 0.7, 0.7) end
</OnEnter>
<OnLeave>
GameTooltip:Hide()
local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.4, 0.4, 0.4) end
</OnLeave>
</Scripts>
</Button>
+3
View File
@@ -215,6 +215,9 @@ function Guda_BankFrame_OnHide(self)
-- Cancel any pending deferred usability check (debounce safety)
CancelBankDeferredUsabilityCheck()
-- Clear search field
Guda_BankFrame_ClearSearch()
-- Clear recently emptied slots tracking (reset placeholders)
BankFrame:ClearRecentlyEmptiedSlots()
+28 -12
View File
@@ -263,7 +263,7 @@
<Anchors>
<Anchor point="LEFT">
<Offset>
<AbsDimension x="40" y="0"/>
<AbsDimension x="16" y="0"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
@@ -294,6 +294,16 @@
</OnEditFocusLost>
<OnTextChanged>
Guda_BankFrame_OnSearchChanged(this)
-- Show/hide clear button based on search content
local clearBtn = getglobal("Guda_BankFrame_SearchBar_ClearButton")
if clearBtn then
local text = this:GetText()
if text ~= "" and text ~= "Search bank..." then
clearBtn:Show()
else
clearBtn:Hide()
end
end
</OnTextChanged>
<OnEscapePressed>
this:SetText("Search bank...")
@@ -307,31 +317,37 @@
</EditBox>
<!-- Clear Search Button -->
<Button name="$parent_ClearButton">
<Button name="$parent_ClearButton" hidden="true">
<Size>
<AbsDimension x="26" y="26"/>
<AbsDimension x="12" y="12"/>
</Size>
<Anchors>
<Anchor point="LEFT">
<Anchor point="RIGHT" relativeTo="$parent_SearchBox" relativePoint="RIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
<AbsDimension x="-5" y="0"/>
</Offset>
</Anchor>
</Anchors>
<NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Up"/>
<PushedTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Down"/>
<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD"/>
<NormalTexture file="Interface\AddOns\Guda\Assets\close"/>
<Scripts>
<OnLoad>
local searchBox = getglobal("Guda_BankFrame_SearchBar_SearchBox")
if searchBox then
this:SetFrameLevel(searchBox:GetFrameLevel() + 1)
end
local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.4, 0.4, 0.4) end
</OnLoad>
<OnClick>
Guda_BankFrame_ClearSearch()
</OnClick>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_TOP")
GameTooltip:SetText("Clear search bar")
GameTooltip:Show()
local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.7, 0.7, 0.7) end
</OnEnter>
<OnLeave>
GameTooltip:Hide()
local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.4, 0.4, 0.4) end
</OnLeave>
</Scripts>
</Button>