DTextEntry for chatbox doesn't take input?

Why is it that when you create a DTextEntry in the below method, it does not allow you to write in it? Also, if you know, how do I fix it?

[lua]
function chatBox.StartChat()
if !chatBox.TextEntry then
chatBox.TextEntry = vgui.Create(“DTextEntry”)
chatBox.TextEntry:SetPos(5, ScrH() - 20)
chatBox.TextEntry:SetWide(600)
end

chatBox.TextEntry:SetVisible(true)
chatBox.TextEntry:RequestFocus()

return true

end
hook.Add(“StartChat”, “chatBox.StartChat”, chatBox.StartChat)
[/lua]

[editline]hey:)[/editline]
Also, if I were to create one using the below method, it still doesn’t let me write in it. Even if I press ‘C’ and click on the DTextEntry.

[lua]
concommand.Add(“loltest”, function()
local textentry = vgui.Create(“DTextEntry”)
textentry:SetWide(300)
textentry:Center()
end)
[/lua]

Have you tried DTextEntry.AllowInput

[editline]13th March 2011[/editline]

or DTextEntry.SetEditable()

I’m fairly sure those are on by default, but yes I just tried adding them and setting them manually, still no luck.

I had this problem as well. BlackOps got it to work, and he showed me the code for it forever ago, but I don’t have it anymore.

A DTextEntry will never gain focus if you don’t have it parented to an EditablePanel or a DFrame

Also, in StartChat, do MakePopup instead of RequestFocus (thanks BlackOps)

With MakePopup I can’t seem to get OUT of focus with it. And I will try parenting it to a DFrame and do some testing.

[editline]hey:)[/editline]
Would you be able to tell me how to get fully out of focus if I were to use MakePopup?

[editline]rawrr[/editline]
Okay so I’ve gotten all I’ve wanted, however I’ve come to notice that with the method I’m using (below), after I hide the DTextEntry, it still displays my mouse and whatever I type goes into the actual, invisible chatbox. How do I completely disable the default chatbox or is there a way around this?

Hide the DFrame, not the text box?

The problem I’m having is that the default chatbox is still there, just invisible. How do I disable it or get around it?

You don’t really need to. Use ChatTextChanged and put that string into your custom chatbox. Don’t allow input directly into your custom chatbox.

I know, I’ve tried this. But the cursor doesn’t show up and highlighting doesn’t work because it’s just setting text. I like the features that come with the DTextEntry. Thanks though.

[editline]Found it out :)[/editline]
Actually I’ve found it out. For anyone else who is trying to get rid of the default code, feel free to refer to the code below.

[lua]
hook.Add(“PlayerBindPress”, “PBPTest”, function(p,b,p)
if string.find(b, “messagemode”) then return true end
end)
[/lua]

I’m pretty sure if you understand that you would know how expand it for teamchat detection and such. Thanks for the help everyone.

[lua]
function GAMEMODE:StartChat()
return true
end
[/lua]

Thanks, but even stated in the wiki: “Makes the chatbox invisible, it’ll still be there just not visible.” The code I posted above disables it. Somewhat.

What I have is this:
[lua]
function GAMEMODE:StartChat()
ChatBox.Visible = true
ChatBox.TextEntry:MakePopup()
return true
end
[/lua]

And it works fine. I can type into the custom chatbox like a normal TextEntry.

That does work, however you need to press enter twice, because after you input the chat into the DTextEntry, there still needs to be an input for the now invisible default chatbox.

[lua]
TextEntry.OnEnter = function()
hook.Call(“FinishChat”, GAMEMODE)
end
[/lua]

That works? I thought I tried that and it didn’t. Well thanks!

No problem. Let me know if you find a solution to the focus thing.

For some reason when I use your method, after I close the chatbox I can move around be do normal stuff, but I can’t get into the menu (console nor esc). Do you know why?

You’ll probably have to do gui.EnableScreenClicker(false).