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 ## Title: Guda
## Notes: All-in-one bag and bank addon for World of Warcraft 1.12.1 (Turtle WoW) ## Notes: All-in-one bag and bank addon for World of Warcraft 1.12.1 (Turtle WoW)
## Author: Vati ## Author: Vati
## Version: 2.0.6 ## Version: 2.0.7
## SavedVariables: Guda_DB ## SavedVariables: Guda_DB
## SavedVariablesPerCharacter: Guda_CharDB ## 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) -- Hide tooltip (it may be showing for soul bag or other footer buttons)
GameTooltip:Hide() GameTooltip:Hide()
-- Clear search field
Guda_BagFrame_ClearSearch()
-- Clear any pending update and work queue items -- Clear any pending update and work queue items
pendingUpdate = false pendingUpdate = false
if addon.Modules.Utils and addon.Modules.Utils.ClearWorkQueue then if addon.Modules.Utils and addon.Modules.Utils.ClearWorkQueue then
+28 -12
View File
@@ -679,7 +679,7 @@
<Anchors> <Anchors>
<Anchor point="LEFT"> <Anchor point="LEFT">
<Offset> <Offset>
<AbsDimension x="40" y="0"/> <AbsDimension x="16" y="0"/>
</Offset> </Offset>
</Anchor> </Anchor>
<Anchor point="RIGHT"> <Anchor point="RIGHT">
@@ -712,6 +712,16 @@
</OnEditFocusLost> </OnEditFocusLost>
<OnTextChanged> <OnTextChanged>
Guda_BagFrame_OnSearchChanged(this) 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> </OnTextChanged>
<OnEscapePressed> <OnEscapePressed>
this:SetText("Search, try ~equipment") this:SetText("Search, try ~equipment")
@@ -723,31 +733,37 @@
</EditBox> </EditBox>
<!-- Clear Search Button --> <!-- Clear Search Button -->
<Button name="$parent_ClearButton"> <Button name="$parent_ClearButton" hidden="true">
<Size> <Size>
<AbsDimension x="26" y="26"/> <AbsDimension x="12" y="12"/>
</Size> </Size>
<Anchors> <Anchors>
<Anchor point="LEFT"> <Anchor point="RIGHT" relativeTo="$parent_SearchBox" relativePoint="RIGHT">
<Offset> <Offset>
<AbsDimension x="5" y="0"/> <AbsDimension x="-5" y="0"/>
</Offset> </Offset>
</Anchor> </Anchor>
</Anchors> </Anchors>
<NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Up"/> <NormalTexture file="Interface\AddOns\Guda\Assets\close"/>
<PushedTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Down"/>
<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD"/>
<Scripts> <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> <OnClick>
Guda_BagFrame_ClearSearch() Guda_BagFrame_ClearSearch()
</OnClick> </OnClick>
<OnEnter> <OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_TOP") local tex = this:GetNormalTexture()
GameTooltip:SetText("Clear search bar") if tex then tex:SetVertexColor(0.7, 0.7, 0.7) end
GameTooltip:Show()
</OnEnter> </OnEnter>
<OnLeave> <OnLeave>
GameTooltip:Hide() local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.4, 0.4, 0.4) end
</OnLeave> </OnLeave>
</Scripts> </Scripts>
</Button> </Button>
+3
View File
@@ -215,6 +215,9 @@ function Guda_BankFrame_OnHide(self)
-- Cancel any pending deferred usability check (debounce safety) -- Cancel any pending deferred usability check (debounce safety)
CancelBankDeferredUsabilityCheck() CancelBankDeferredUsabilityCheck()
-- Clear search field
Guda_BankFrame_ClearSearch()
-- Clear recently emptied slots tracking (reset placeholders) -- Clear recently emptied slots tracking (reset placeholders)
BankFrame:ClearRecentlyEmptiedSlots() BankFrame:ClearRecentlyEmptiedSlots()
+28 -12
View File
@@ -263,7 +263,7 @@
<Anchors> <Anchors>
<Anchor point="LEFT"> <Anchor point="LEFT">
<Offset> <Offset>
<AbsDimension x="40" y="0"/> <AbsDimension x="16" y="0"/>
</Offset> </Offset>
</Anchor> </Anchor>
<Anchor point="RIGHT"> <Anchor point="RIGHT">
@@ -294,6 +294,16 @@
</OnEditFocusLost> </OnEditFocusLost>
<OnTextChanged> <OnTextChanged>
Guda_BankFrame_OnSearchChanged(this) 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> </OnTextChanged>
<OnEscapePressed> <OnEscapePressed>
this:SetText("Search bank...") this:SetText("Search bank...")
@@ -307,31 +317,37 @@
</EditBox> </EditBox>
<!-- Clear Search Button --> <!-- Clear Search Button -->
<Button name="$parent_ClearButton"> <Button name="$parent_ClearButton" hidden="true">
<Size> <Size>
<AbsDimension x="26" y="26"/> <AbsDimension x="12" y="12"/>
</Size> </Size>
<Anchors> <Anchors>
<Anchor point="LEFT"> <Anchor point="RIGHT" relativeTo="$parent_SearchBox" relativePoint="RIGHT">
<Offset> <Offset>
<AbsDimension x="5" y="0"/> <AbsDimension x="-5" y="0"/>
</Offset> </Offset>
</Anchor> </Anchor>
</Anchors> </Anchors>
<NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Up"/> <NormalTexture file="Interface\AddOns\Guda\Assets\close"/>
<PushedTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Down"/>
<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD"/>
<Scripts> <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> <OnClick>
Guda_BankFrame_ClearSearch() Guda_BankFrame_ClearSearch()
</OnClick> </OnClick>
<OnEnter> <OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_TOP") local tex = this:GetNormalTexture()
GameTooltip:SetText("Clear search bar") if tex then tex:SetVertexColor(0.7, 0.7, 0.7) end
GameTooltip:Show()
</OnEnter> </OnEnter>
<OnLeave> <OnLeave>
GameTooltip:Hide() local tex = this:GetNormalTexture()
if tex then tex:SetVertexColor(0.4, 0.4, 0.4) end
</OnLeave> </OnLeave>
</Scripts> </Scripts>
</Button> </Button>