Garry's Mod Wiki

Garry's Mod Wiki

  DTextEntry:AddHistory( string text )

Description

Adds an entry to DTextEntry's history.

See DTextEntry:SetHistoryEnabled.

Arguments

1 string text
Text to add to the text entry's history.

Example

A simple example.

-- Create a new frame (window) local frame = vgui.Create( "DFrame" ) frame:SetSize( 300, 300 ) -- Set the size of the frame frame:Center() -- Center the frame on the screen frame:MakePopup() -- Make the frame appear in front of other windows and accept user input -- Create a text entry field within the frame local tEntry = vgui.Create("DTextEntry", frame) tEntry:Dock(TOP) -- Dock the text entry at the top of the frame tEntry:SetHistoryEnabled(true) -- Dock the text entry at the top of the frame tEntry.OnEnter = function( self ) local val = self:GetValue() self:AddHistory( val ) -- Store old value in history so the player can access it again later self:SetText( "" ) -- reset the text -- Do something with the data... chat.AddText( val ) -- print the textentry text as a chat message end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...