Kill search focus when clicking outside of editor

This commit is contained in:
DBotThePony 2021-05-02 09:54:23 +07:00
parent 0b05459aff
commit 88bf607370
No known key found for this signature in database
GPG Key ID: DCC23B5715498507
2 changed files with 21 additions and 3 deletions

View File

@ -271,12 +271,21 @@ do -- list
search:Dock(TOP)
search:SetPlaceholderText("Search...")
search.OnTextChanged = function()
search:SetUpdateOnType(true)
--[[
function search:OnKeyCode(code)
if code == KEY_ESCAPE then
self:KillFocus()
end
end
]]
search.OnValueChange = function(_, pattern)
self.scr:SetScroll(0)
local pattern = search:GetValue()
local group
for i,v in ipairs(self.List) do
local found = false
@ -331,6 +340,7 @@ do -- list
end
end
end
self.search = search
self.List = {}

View File

@ -100,6 +100,14 @@ function pace.GUIMousePressed(mc)
if IsValid(hoveredPanelCursor) then
hoveredPanelCursor:SetCursor('sizeall')
if IsValid(pace.properties) and IsValid(pace.properties.search) and pace.properties.search:HasFocus() then
-- pace.properties.search:KillFocus()
-- it won't let it's focus taken easily
-- thanks gmod
pace.properties:RequestFocus()
pace.properties:KillFocus()
end
end
mcode = mc