Wiki Help

Revision Difference

editing#564577

<cat>editing</cat>⤶ <title>Quick Guide To Editing</title>⤶ # Markdown⤶ ⤶ The pages are edited using markdown. Here's a quick reference. ⤶ ```⤶ ⤶ Styles:⤶ *Italic*⤶ **Bold**⤶ ⤶ ⤶ ⤶ Links:⤶ ⤶ Link to [a page](http://www.google.com)⤶ ⤶ Link to another wiki page: <page>Bug</page>⤶ ⤶ ⤶ ⤶ Titles:⤶ # Main title⤶ ## Subtitle⤶ ⤶ ⤶ ⤶ Lists:⤶ ⤶ * List Item One⤶ * List Item Two⤶ ⤶ 1. Item⤶ 2. Item⤶ * Mixed⤶ * Mixed 3. Item⤶ ⤶ ```⤶ ⤶ ⤶ ⤶ #Uploading Images⤶ ⤶ To add images just drag and drop them to the page and wait for the code to fill in.⤶ <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)">&nbsp;</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⤶