Wiki Help
Home
/
Edit SKIN:PaintTextEntry
View
Edit
History
No Category
Editing The Wiki
Custom Tags
Tests
Log in to edit
SKIN:PaintTextEntry
<cat>hook</cat> <title>SKIN:PaintTextEntry</title> # SKIN:PaintTextEntry This function is used to define how a `DTextEntry` is drawn within a Derma skin. It is commonly used to render the background, text, text selection, and caret (cursor) using the `Panel:DrawTextEntryText` method. <a class="realm_icon" href="/gmod/States" title="This function is available in client and menu state(s)"> </a> ## Description Used to draw the text in a [`DTextEntry`](<page>DTextEntry</page>) within a Derma skin. This is usually called inside the [`SKIN:PaintTextEntry`](<page>SKIN:PaintTextEntry</page>) skin hook to render custom styles. > **Note:** Will silently fail if any of the arguments to `DrawTextEntryText` are not given. > **Note:** This is a rendering function that requires a **2D rendering context**. This means it will only work inside [2D Rendering Hooks](<page>2d_Rendering_Hooks</page>) such as `Paint`, `PaintOver`, etc. --- ## Arguments 1. [`table`](<page>table</page>) `textCol` The color of the main text. 2. [`table`](<page>table</page>) `highlightCol` The color used for highlighting selected text. 3. [`table`](<page>table</page>) `cursorCol` The color of the text caret (cursor). --- ## Example The following example shows how the default GMod skin uses `SKIN:PaintTextEntry` to render the background and text of a `DTextEntry`: ```lua function SKIN:PaintTextEntry(panel, w, h) if (panel.m_bBackground) then if (panel:GetDisabled()) then self.tex.TextBox_Disabled(0, 0, w, h) elseif (panel:HasFocus()) then self.tex.TextBox_Focus(0, 0, w, h) else self.tex.TextBox(0, 0, w, h) end end panel:DrawTextEntryText( panel.m_colText, -- Text color panel.m_colHighlight, -- Highlight color panel.m_colCursor -- Cursor color ) end
Wiki Help
The Facepunch Wiki
Editing The Wiki
7
Code Blocks
About This Wiki
Bugs And Requests
Headings
Tables
Uploading Images & Files
View Formatting
Custom Tags
19
Ambig
Bug
Cat
Deprecated
Example
Function
Internal
Key
Member
Note
Page
Page List
Removed
Rustitem
Structure
Title
Type
Validate
Warning
Tests
2
Markdown
Syntax Highlight: Lua