• help with DTextEntry
    4 replies, posted
Im trying to make a panel that stores a name using DTextEntry but it won't let me type is there a way to disable player movement as well as make it so player doesn't spawn till the name is entered?
Did you call MakePopup on the frame? Also if you remove any way of closing the window, except for entering a name, that should do it.
[QUOTE=Ducky3426;45865383]Did you call MakePopup on the frame? Also if you remove any way of closing the window, except for entering a name, that should do it.[/QUOTE] i have it parented to a DPanel would MakePopup work still?
I remember I made something similar, give me a second and I'll give you an example code. [lua] local pnlEntry = vgui.Create("DTextEntry", pnl) pnlEntry:SetSize(100,20) pnlEntry:SetPos(5,5) pnlEntry:SetTextColor(Color(0,0,0,100)) pnlEntry:SetText("Name..") pnlEntry.OnGetFocus = function() if pnlEntry:GetText() == "Name.." then pnlEntry:SetTextColor(Color(0,0,0,255)) pnlEntry:SetText("") end end pnlEntry.OnEnter = function(self) -- change name code here end [/lua]
if you parent it to a DFrame and do DFrame:MakePopup() it will take care of capturing the mouse/keyboard input for you You might also like to look at these: DFrame:SetBackgroundBlur(true) DFrame:SetDraggable(false) DFrame:ShowCloseButton(false) This code centers the frame on the player's screen: --set the size here FIRST with SetSize(x,y) DFrame:SetPos(ScrW() / 2 - DFrame:GetWide() / 2, ScrH() / 2 - DFrame:GetTall() / 2)
Sorry, you need to Log In to post a reply to this thread.