• Make a button change its color after being hovered and clicked.
    4 replies, posted
I've had huge trouble making my DButton change its colour when I hover my mouse over it and change its colour again when it is pressed/held down, anyone knows how to do it? -Thanks!
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PANEL/Paint]PANEL:Paint[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/IsHovered]Panel:IsHovered[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/DButton/IsDown]DButton:IsDown[/url]
Thanks, I got it to work by using the OnCursorEntered and OnCursorExited
It can be done in the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/PANEL/Paint]PANEL:Paint[/url] function alone using the functions Synix linked.
If you need an example; [CODE]DButton.Paint = function( self ) if self:IsHovered() then -- draw highlighted shit else -- draw shit end end[/CODE]
Sorry, you need to Log In to post a reply to this thread.