• DListView - GWEN makes me mad. (Defaults to black text and i dont know how to change it. Really?)
    10 replies, posted
Hello everyone. Rather flustered as of late due to GWEN making DListView default to having black text, when im insure how to change it. My DListView is custom skinned, so i am able to edit the skin to change the text (If i can figure out what to call to do so) I posted a thread on this a bit back, and all i got back was someone telling me to set the DLabel text's color. im not 100% sure that sticking that into the skin will fix it. Here's an image of my issue. [img]http://puu.sh/1daH4[/img] And for reference, here's my skin code for the listview, although im not sure it will help you a load in helping me figure out how to set the text color. [lua] function SKIN:PaintListView( panel ) if panel.m_bBackground then surface.SetDrawColor( 10, 10, 10, 180 ) panel:DrawFilledRect() local wid, hei = panel:GetSize() surface.SetDrawColor(0, 0, 0, 100) surface.DrawRect(1, 1, wid - 2, hei - 2) surface.SetDrawColor(255, 0, 0, 200) surface.DrawRect(1, 0, wid - 2, 1) surface.DrawRect(0, 1, 1, hei - 2) surface.DrawRect(1, hei - 1, wid - 2, 1) surface.DrawRect(wid - 1, 1, 1, hei - 2) surface.SetDrawColor(255, 0, 0, 200) surface.DrawRect(1, 1, 1, 1) surface.DrawRect(wid - 2,1, 1, 1) surface.DrawRect(1, hei - 2, 1, 1) surface.DrawRect(wid - 2, hei - 2, 1, 1) end end function SKIN:PaintListViewLine( panel ) local Col = nil if panel:IsSelected() then Col = self.listview_selected elseif panel.Hovered then Col = self.listview_hover elseif panel.m_bAlt then Col = self.bg_alt2 else return end surface.SetDrawColor( Col.r, Col.g, Col.b, Col.a ) surface.DrawRect( 0, 0, panel:GetWide(), panel:GetTall() ) end [/lua] Any help would be appreciated! thanks in advance.
The color for DListView text is defined in vgui/dlistview_line.lua, on line 25 where it sets the color. [lua] function PANEL:UpdateColours( skin ) if ( self:GetParent():IsLineSelected() ) then return self:SetTextStyleColor( skin.Colours.Label.Bright ) end return self:SetTextStyleColor( skin.Colours.Label.Dark ) end [/lua] Just call SetTextStyleColor(<color>) on the label control.
by "Label Control" do you mean my SKIN:PaintListViewLine() function or the area in which i create entries to the DListView? putting panel:SetTextStyleColor( Color(255,255,255)) inside of SKIN:PaintListViewLine(panel) caused some errors. (refer to my function above to find out what panel is referring to.) [editline]10th October 2012[/editline] SetTextStyleColor is a nil value in the panel paint func for the said DlistView's as well.
Just change [i]SKIN.Colours.Label.Dark[/i] and [i]SKIN.Colours.Label.Bright[/i].
attempt to index field 'Colours' (a nil value) Nope.
[QUOTE=Archemyde;37979934]attempt to index field 'Colours' (a nil value) Nope.[/QUOTE] You [b]must[/b] have those in the skin's file.
[lua] local SKIN = {} local TEX_GRADIENT = surface.GetTextureID( "gui/gradient_down" ) local TEX_GRADIENT_UP = surface.GetTextureID( "gui/gradient_up" ) local TEX_GRADIENT_RIGHT = surface.GetTextureID( "vgui/gradient-r" ) local MAT_BLUR = Material( "pp/blurscreen" ) SKIN.DermaVersion = 1 SKIN.bg_color = Color( 10, 10, 10, 200 ) SKIN.bg_color_sleep = Color( 50, 50, 50, 200 ) SKIN.bg_color_dark = Color( 0, 0, 0, 200 ) SKIN.bg_color_bright = Color( 20, 20, 20, 200 ) SKIN.bg_alt1 = Color( 10, 10, 10, 200 ) SKIN.bg_alt2 = Color( 12, 12, 12, 200 ) SKIN.panel_transback = Color( 10, 10, 10, 200 ) SKIN.colPropertySheet = Color( 0, 0, 0, 200 ) SKIN.colTab = SKIN.colPropertySheet SKIN.colTabInactive = Color( 80,80, 80, 255 ) SKIN.colTabShadow = Color( 0, 0, 0, 255 ) SKIN.colTabText = Color( 255, 255, 255, 255 ) SKIN.colTabTextInactive = Color( 255, 255, 255, 255 ) SKIN.colButtonText = Color( 255, 255, 255, 255 ) SKIN.colButtonTextDisabled = Color( 255, 0, 0, 255 ) SKIN.colButtonBorder = Color( 255, 0, 0, 255 ) SKIN.colButtonBorderHighlight = Color( 255, 0, 0, 255 ) SKIN.colButtonBorderShadow = Color( 255, 0, 0, 255 ) SKIN.colTextEntryBG = Color( 255, 255, 255, 255 ) SKIN.colTextEntryBorder = Color( 150, 0, 10, 255 ) SKIN.colTextEntryText = Color( 255, 255, 255, 255 ) SKIN.colTextEntryTextHighlight = Color( 255, 255, 255, 255 ) SKIN.listview_hover = Color( 255, 102, 60, 255 ) SKIN.listview_selected = Color( 255, 50, 50, 255 ) [/lua] Doesn't look like it. [editline]10th October 2012[/editline] Progress! [lua] for k, pnl in pairs(panel.Columns) do pnl:SetTextColor(Color(255,255,255)) end [/lua] inside of PaintListViewLine. But, theres a new issue. [img]http://puu.sh/1dekc[/img] This. Doesnt color all of them. It changes the color to what its supposed to be when i mouse over.
SetTextStyleColor isn't part of the DListView, it is part of the DListView line's text control. Go into the file and see yourself.
[QUOTE=Chessnut;37980122]SetTextStyleColor isn't part of the DListView, it is part of the DListView line's text control. Go into the file and see yourself.[/QUOTE] i don't understand how that helps me. Can you give me an example of usage?
[QUOTE=Archemyde;37980377]i don't understand how that helps me. Can you give me an example of usage?[/QUOTE] Just crate the damn SKIN.Colours table in your skin and add those colors. The DListViewLine_Label automatically takes those colors. The first place you [B]should[/B] have checked is the default skin file.
[QUOTE=vercas;37983022]Just crate the damn SKIN.Colours table in your skin and add those colors. The DListViewLine_Label automatically takes those colors. The first place you [B]should[/B] have checked is the default skin file.[/QUOTE] i really dislike it when people get short with confused people. it doesnt help either party in the situation. Also, i've done just this, still no luck. Same issue. [editline]11th October 2012[/editline] Fixed the issue entirely. Moved the code that i put above to the top of the file (There were conditions in the way of it being drawn on every line) Thanks for the help anyways, everyone.
Sorry, you need to Log In to post a reply to this thread.