Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DColorButton - Tooltip enabled when color is changed #3836

Closed
Alphaverse opened this issue May 2, 2019 · 0 comments

Comments

@Alphaverse
Copy link

commented May 2, 2019

Details

When you create a DColorButton and try to disable the Tooltip (which always displays the RGBA values of the button) there will occur the following problem:

When the DColorButton is created the Tooltip won't be shown. But as soon as you change the color of a DColorButton since its creation the Tooltip will be visible again.

As an example: If you change the color of a DColorButton with a click on it the tooltip will be visible again after the color was changed.

Steps to reproduce

Just create the following Panel and open it. If you hover the button there will be no Tooltip. But if you click the button the Tooltip will appear.

local panel = vgui.Create("DPanel")
panel:SetSize(100, 50)
panel:Center()
panel:MakePopup()

local colorButton = vgui.Create("DColorButton", panel)
colorButton:SetSize(100, 50)
colorButton:SetPos(0, 0)
colorButton:Paint(colorButton:GetSize())
colorButton:SetText("Button")
colorButton:SetColor(Color(255, 0, 0))
colorButton:SetTooltip(false)
colorButton.DoClick = function()
	colorButton:SetColor(Color(0, 255, 0))
end

Possible workaround at the moment

Just call colorButton:SetTooltip(false) again after changing the color.

Suggestion regarding this Tooltip

You should need to specifically enable this Tooltip instead of showing it by default...
Then you don't have to disable the Tooltip every time you change the color.

In general, I still don't know why this Tooltip exists. It just displays the RGBA values of the button. Looks more like a Dev-Tool to me, not like something that should be in-game.

What is causing the problem

https://github.com/Facepunch/garrysmod/blob/394ae745df8f8f353ea33c8780f012fc000f4f56/garrysmod/lua/vgui/dcolorbutton.lua

function PANEL:SetColor( color )
        [...]
	self:SetTooltip( colorStr )
        [...]
end

@Alphaverse Alphaverse changed the title DColorButton - Can't disable Tooltip DColorButton - Tooltip enabled when color is changed May 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.