-- Clear search focus when clicking toolbar local searchBox = getglobal("Guda_BagFrame_SearchBar_SearchBox") if searchBox then searchBox:ClearFocus() end local text = getglobal(this:GetName().."_Text") if text then text:SetText("0 / 0") text:SetTextColor(0.8, 0.8, 0.8) end if this:GetText() == "Search, try ~equipment" then this:SetText("") this:SetTextColor(1, 1, 1, 1) end -- Show click catcher to detect clicks outside bag local clickCatcher = getglobal("Guda_ClickCatcher") if clickCatcher then clickCatcher:Show() end -- Hide click catcher when focus is lost local clickCatcher = getglobal("Guda_ClickCatcher") if clickCatcher then clickCatcher:Hide() end local wasEmpty = (this:GetText() == "") -- Restore placeholder if empty when focus is lost if wasEmpty then this:SetText("Search, try ~equipment") this:SetTextColor(0.5, 0.5, 0.5, 1) Guda_BagFrame_OnSearchChanged(this) end -- In "toggle" mode, empty + focus-lost collapses the bar. if wasEmpty and Guda and Guda.Modules and Guda.Modules.BagFrame and Guda.Modules.BagFrame.searchBarExpanded then Guda.Modules.BagFrame:ToggleSearchBar() end 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 this:SetText("Search, try ~equipment") this:SetTextColor(0.5, 0.5, 0.5, 1) this:ClearFocus() Guda_BagFrame_OnSearchChanged(this) -- Collapse if in toggle mode; no-op otherwise. if Guda and Guda.Modules and Guda.Modules.BagFrame and Guda.Modules.BagFrame.searchBarExpanded then Guda.Modules.BagFrame:ToggleSearchBar() end -- Set tooltip handlers on money button children Guda_BagFrame_MoneyFrame_OnLoad(this) -- Drop item into first available bag slot if CursorHasItem and CursorHasItem() then if PutItemInBackpack then PutItemInBackpack() end for bag = 1, 4 do if CursorHasItem() then local invSlot = ContainerIDToInventoryID(bag) if PutItemInBag then PutItemInBag(invSlot) end end end end Guda_ClearCursorItem() Guda_BagFrame_OnLoad(this) Guda_BagFrame_OnShow(this) Guda_BagFrame_OnHide(this) -- Clear search box focus when clicking on bag frame (1.12.1 safe) local searchBox = getglobal("Guda_BagFrame_SearchBar_SearchBox") if searchBox then searchBox:ClearFocus() end if (arg1 == "LeftButton") then this:StartMoving() end this:StopMovingOrSizing() -- Drop item into first available bag slot if CursorHasItem and CursorHasItem() then if PutItemInBackpack then PutItemInBackpack() end for bag = 1, 4 do if CursorHasItem() then local invSlot = ContainerIDToInventoryID(bag) if PutItemInBag then PutItemInBag(invSlot) end end end end Guda_ClearCursorItem()