Permalink
Browse files

Fixed text changing in text entry

When updating from history or from the menu, the proper function(s)
is/are being called now, to allow autocomplete support and
callback/event support.
  • Loading branch information...
1 parent b62f338 commit 064effc3a694367fdd668e93fff948b240fbcd19 @vercas vercas committed Dec 19, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 garrysmod/lua/vgui/dtextentry.lua
@@ -148,6 +148,8 @@ function PANEL:UpdateFromHistory()
self:SetText( text )
self:SetCaretPos( text:len() )
+
+ self:OnTextChanged()
self.HistoryPos = pos
@@ -175,6 +177,8 @@ function PANEL:UpdateFromMenu()
self:SetText( txt )
self:SetCaretPos( txt:len() )
+
+ self:OnTextChanged(true)
self.HistoryPos = pos
@@ -183,7 +187,7 @@ end
--[[---------------------------------------------------------
OnTextChanged
-----------------------------------------------------------]]
-function PANEL:OnTextChanged()
+function PANEL:OnTextChanged(noMenuRemoval)
self.HistoryPos = 0
@@ -192,7 +196,7 @@ function PANEL:OnTextChanged()
self:OnValueChange( self:GetText() )
end
- if ( IsValid( self.Menu ) ) then
+ if ( IsValid( self.Menu ) and not noMenuRemoval ) then
self.Menu:Remove()
end

0 comments on commit 064effc

Please sign in to comment.