Garry's Mod Wiki

Revision Difference

DTextEntry#551254

<panel> <parent>TextEntry</parent> <realm>Client and Menu</realm> <description> A form which may be used to display text the player is meant to select and copy or alternately allow them to enter some text of their own. ⤶ <note>Do note that at least one of your `DTextEntry`'s parents must either be an <page>EditablePanel</page> or derived from it (like a <page>DFrame</page>, for example), else it won't be able to focus and thus be unselectable. ⤶ <note>At least one of your `DTextEntry`'s parents must either be an <page>EditablePanel</page> or derived from it (like a <page>DFrame</page>, for example), else it won't be able to focus and thus be unselectable. You must also call <page>Panel:MakePopup</page> on said panel or the `DTextEntry` will not work.</note> </description> </panel> <example> <description>Creates a text entry form that allows you to print messages into the local player's chat window. </description> <code> concommand.Add( "test_textentry", function(ply) local frame = vgui.Create( "DFrame" ) frame:SetSize( 400, 200 ) frame:Center() frame:MakePopup() local TextEntry = vgui.Create( "DTextEntry", frame ) -- create the form as a child of frame TextEntry:Dock( TOP ) TextEntry.OnEnter = function( self ) chat.AddText( self:GetValue() ) -- print the textentry text as a chat message end local TextEntryPH = vgui.Create( "DTextEntry", frame ) TextEntryPH:Dock( TOP ) TextEntryPH:DockMargin( 0, 5, 0, 0 ) TextEntryPH:SetPlaceholderText( "I am a placeholder" ) TextEntryPH.OnEnter = function( self ) chat.AddText( self:GetValue() ) end end ) </code> <output> <upload src="70c/8d88bebe8e67219.png" size="11372" name="image.png" /> </output> </example> # Undocumented Methods * <page>DTextEntry:AddHistory</page> * <page>DTextEntry:GetDisabled</page> * <page>DTextEntry:GetDrawBackground</page> * <page>DTextEntry:GetDrawBorder</page> * <page>DTextEntry:GetFont</page> * <page>DTextEntry:GetHighlightColor</page> * <page>DTextEntry:GetHistoryEnabled</page> * <page>DTextEntry:GetTabbingDisabled</page> * <page>DTextEntry:SetDrawBackground</page> * <page>DTextEntry:SetDrawBorder</page> * <page>DTextEntry:SetHighlightColor</page> * <page>DTextEntry:SetHistoryEnabled</page> * <page>DTextEntry:UpdateConvarValue</page> * <page>DTextEntry:UpdateFromHistory</page> * <page>DTextEntry:UpdateFromMenu</page>