From fbc43877999e299fbb5893e977d10d20d123e41c Mon Sep 17 00:00:00 2001 From: Redox Date: Sun, 12 May 2024 02:27:41 +0200 Subject: [PATCH 1/4] Fix searchbar error --- lua/wire/client/wire_expression2_browser.lua | 21 +------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/lua/wire/client/wire_expression2_browser.lua b/lua/wire/client/wire_expression2_browser.lua index 14db766bfe..f0161ac7f6 100644 --- a/lua/wire/client/wire_expression2_browser.lua +++ b/lua/wire/client/wire_expression2_browser.lua @@ -152,7 +152,7 @@ function PANEL:Init() self.SearchBox = vgui.Create( "DTextEntry", self ) self.SearchBox:Dock( TOP ) self.SearchBox:DockMargin( 0,0,0,0 ) - self.SearchBox:SetValue( "Search..." ) + self.SearchBox:SetPlaceholderText( "Search..." ) local clearsearch = vgui.Create( "DImageButton", self.SearchBox ) clearsearch:SetMaterial( "icon16/cross.png" ) @@ -160,31 +160,12 @@ function PANEL:Init() function clearsearch:DoClick() src:SetValue( "" ) src:OnEnter() - src:SetValue( "Search..." ) end clearsearch:DockMargin( 2,2,4,2 ) clearsearch:Dock( RIGHT ) clearsearch:SetSize( 14, 10 ) clearsearch:SetVisible( false ) - - local old = self.SearchBox.OnGetFocus - function self.SearchBox:OnGetFocus() - if self:GetValue() == "Search..." then -- If "Search...", erase it - self:SetValue( "" ) - end - old( self ) - end - - -- On lose focus - local old = self.SearchBox.OnLoseFocus - function self.SearchBox:OnLoseFocus() - if self:GetValue() == "" then -- if empty, reset "Search..." text - timer.Simple( 0, function() self:SetValue( "Search..." ) end ) - end - old( self ) - end - function self.SearchBox.OnEnter() local str = self.SearchBox:GetValue() From 5710c4222b17608328b211a2988365afc770779e Mon Sep 17 00:00:00 2001 From: Redox Date: Sun, 12 May 2024 02:42:56 +0200 Subject: [PATCH 2/4] Remove unused functions --- lua/wire/client/wire_expression2_browser.lua | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/lua/wire/client/wire_expression2_browser.lua b/lua/wire/client/wire_expression2_browser.lua index f0161ac7f6..0cbc3c6971 100644 --- a/lua/wire/client/wire_expression2_browser.lua +++ b/lua/wire/client/wire_expression2_browser.lua @@ -14,23 +14,6 @@ local invalid_filename_chars = { [" "] = "_", } -local function GetFileName(name) - local name = string.Replace(name, ".txt", "") - return string.Replace(name, "/", "") -end - -local function InternalDoClick(self) - self:GetRoot():SetSelectedItem(self) - if (self:DoClick()) then return end - if (self:GetRoot():DoClick(self)) then return end -end - -local function InternalDoRightClick(self) - self:GetRoot():SetSelectedItem(self) - if (self:DoRightClick()) then return end - if (self:GetRoot():DoRightClick(self)) then return end -end - local function fileName(filepath) return string.match(filepath, "[/\\]?([^/\\]*)$") end From d369f16bfa1ccc66422a1936629435038b003004 Mon Sep 17 00:00:00 2001 From: Redox Date: Sun, 12 May 2024 02:46:47 +0200 Subject: [PATCH 3/4] Use non deprecated version of func for linter --- lua/wire/client/wire_expression2_browser.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/client/wire_expression2_browser.lua b/lua/wire/client/wire_expression2_browser.lua index 0cbc3c6971..13c42b8e41 100644 --- a/lua/wire/client/wire_expression2_browser.lua +++ b/lua/wire/client/wire_expression2_browser.lua @@ -130,7 +130,7 @@ function PANEL:StartSearch( str ) end function PANEL:Init() - self:SetDrawBackground(false) + self:SetPaintBackground(false) self.SearchBox = vgui.Create( "DTextEntry", self ) self.SearchBox:Dock( TOP ) From d0bf91dded881bfc021a278267dc2e63ac54f41a Mon Sep 17 00:00:00 2001 From: Redox Date: Mon, 13 May 2024 05:32:01 +0200 Subject: [PATCH 4/4] Style suggestion Co-authored-by: Denneisk <20892685+Denneisk@users.noreply.github.com> --- lua/wire/client/wire_expression2_browser.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/client/wire_expression2_browser.lua b/lua/wire/client/wire_expression2_browser.lua index 13c42b8e41..eed18f44c7 100644 --- a/lua/wire/client/wire_expression2_browser.lua +++ b/lua/wire/client/wire_expression2_browser.lua @@ -135,7 +135,7 @@ function PANEL:Init() self.SearchBox = vgui.Create( "DTextEntry", self ) self.SearchBox:Dock( TOP ) self.SearchBox:DockMargin( 0,0,0,0 ) - self.SearchBox:SetPlaceholderText( "Search..." ) + self.SearchBox:SetPlaceholderText("Search...") local clearsearch = vgui.Create( "DImageButton", self.SearchBox ) clearsearch:SetMaterial( "icon16/cross.png" )