DTextEntry Password

Hello,

I look how replace the value of Password to asterisk. I tested some solutions which do not have to work


	
          ---Password---
local Password = vgui.Create("DTextEntry", TextBack)
	Password:SetPos(50, 95)
	Password:SetSize(150, 20)
	Password:SetMultiline(false)
	Password:SetDrawLanguageID(false)


Thank in advance

You’ll have to build your own textbox system, although it’s pretty useless since you passwords in gmod are something not usable due it’s a home game and login system via steamid account it’s not something usable…

Althought i can recommend you to use Paint hook and draw an asterisk for every character in textbox, if you were looking for a built solution, there’s no one, so you would need to build yours

Or you could kinda ‘hack’ it



vguiPasswordMask = vgui.Create ("DLabel")

vguiPasswordInput = vgui.Create ("DTextEntry")
vguiPasswordInput:SetTextColor (Color (0, 0, 0, 0))
vguiPasswordInput.OnValueChange = function (strValue)
    vguiPasswordMask:SetText (string.rep ("*", #strValue))
end

do
    x, y = vguiPasswordInput:GetPos  ()
    w, h = vguiPasswordInput:GetSize ()

    vguiPasswordMask:SetFont (vguiPasswordInput:GetFont ())
    vguiPasswordMask:SetTextColor (Color (0, 0, 0, 255))

    vguiPasswordMask:SetPos  (x, y)
    vguiPasswordMask:SetSize (w, h)
    vguiPasswordMask.DoClick = function ()
        -- I don't know if this would work or not.
        vguiPasswordInput:OnGetFocus ()
    end
end