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: Added ability to choose Tooltip #1583

Merged
merged 5 commits into from May 17, 2019

Conversation

@Alphaverse
Copy link
Contributor

commented May 6, 2019

Added a boolean value to SetColor() for the DColorButton so you are able to choose to show the color string tooltip. The default value is false.

Now the tooltip won't be reset every time the color is changed but you are still able to view it if you want to.

Fixes #Facepunch/garrysmod-issues#3836

DColorButton: Added ability to choose Tooltip
Added a boolean value to SetColor() so you are able to choose to show the color string tooltip. The default value is false. Now the tooltip won't be reset every time the color is changed but you are still able to view it if you want.
@sanny-io

This comment has been minimized.

Copy link
Contributor

commented May 6, 2019

Default arguments do not exist in lua at a language level. That is a syntax error.

Removed standard value
Unecessary and wasn't working because I'm stupid.
@Alphaverse

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2019

Default arguments do not exist in lua at a language level. That is a syntax error.

Yes i fixed it... Worked with another language just before I created this..

@BlackCetha

This comment has been minimized.

Copy link
Contributor

commented May 7, 2019

So you are saying you haven't tested this once?

@Alphaverse

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2019

I tested it. But added this value after it because I had the idea and it hadn't changed much. Only forgot the default value thing.

local colorStr = "R: " .. color.r .. "\nG: " .. color.g .. "\nB: " .. color.b .. "\nA: " .. color.a

self:SetTooltip( colorStr )
if ( displayTooltip == true ) then

This comment has been minimized.

Copy link
@Alf21

Alf21 May 7, 2019

Contributor

To support the old behaviour, you should check

if displayTooltip ~= false then

or use

if displayTooltip == nil then 
    displayTooltip = true 
end

This comment has been minimized.

Copy link
@Alphaverse

Alphaverse May 8, 2019

Author Contributor

I changed it so everything works the same as long as you don't add a false after the color.

Remade old functionaltity
If it the bool "displayTooltip" is true OR nil it will display the color string. If not it won't and will just set the color without changing the tooltip.
@Alphaverse

This comment has been minimized.

Copy link
Contributor Author

commented May 8, 2019

So everything is the same as before now. The only thing is that you can add a false after the color and the Tooltip won't display. Simply but useful in my opinion.

@robotboy655

This comment has been minimized.

Copy link
Collaborator

commented May 16, 2019

Shouldn't the argument be true for no tooltip? This way the code is simpler and it is consistent with the rest of the game.

Update dcolorbutton.lua
Value to hide the Tooltip from setColor needs to be true now.
Update dcolorbutton.lua
Made code more simple

@robotboy655 robotboy655 merged commit 01ec7bc into Facepunch:master May 17, 2019

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