• vgui.register(...) won't allow DoClick!
    2 replies, posted
/*--------------------------------------------------------------------------- MadeN.DButton ---------------------------------------------------------------------------*/ local PANEL = {} function PANEL:Init() self:SetMouseInputEnabled(true) end function PANEL:SetColor(color) self.Color = color end function PANEL:Paint(w,h) local clr = self.Color or Color(0,140,0) draw.RoundedBox(0,0,0,w,h,Color(clr.r-30,clr.g-30,clr.b-30)) draw.RoundedBox(0,3,3,w-3*2,h-3*2,clr) if (self.Shadow or true) then draw.SimpleText(self.Text or "Click Me",self.Font or "DermaDefaultBold", self:GetWide()/2 - 2,self:GetTall()/2 - 1, Color(0,0,0,150), 1,1) end draw.SimpleText(self.Text or "Click Me",self.Font or "DermaDefaultBold", self:GetWide()/2,self:GetTall()/2, self.TextColor or Color(255,255,255), 1,1) if self:IsHovered() then draw.RoundedBox(0,3,3,w-3*2,h-3*2,Color(0,0,0,20)) end end function PANEL:DoClick() print("I've been clicked") end vgui.Register("MadeN.DButton",PANEL)
If you want your panel to have functions like DoClick you have to set the base panel to "Label" or any other element that has "Label" as the base such as "DLabel" or "DButton".
You want DLabel, not Label
Sorry, you need to Log In to post a reply to this thread.