• Painting a textbox
    2 replies, posted
so, How do you paint a textbox(DTextEntry) and keep the functionality of a normal unpainted one?
override the Paint function on the panel and then use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/DrawTextEntryText]Panel:DrawTextEntryText[/url] inside it to draw the text and highlight
By the way, for reference, if you want to know how the DTextEntry paints itself, [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dtextentry.lua#L248-L253"]the code is here[/URL]: [CODE] function PANEL:Paint( w, h ) derma.SkinHook( "Paint", "TextEntry", self, w, h ) return false end [/CODE] Also, the skinhook for TextEntry [URL="https://github.com/garrynewman/garrysmod/blob/1de59398c479dfa9819b7f9c6dc7fd8457a84433/garrysmod/lua/skins/default.lua#L429-L445"]is this[/URL]: [CODE] 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:GetTextColor(), panel:GetHighlightColor(), panel:GetCursorColor() ) end [/CODE]
Sorry, you need to Log In to post a reply to this thread.