So I have a DImageButton, that is 32x32. It starts off SetStretchToFit set to false, which works for the most part. The icon is small. Now, I have a function (by the way dibUno.m_bStretchToFit = true is the same thing as dibUno:SetStretchToFit( true ) so I've tried that):
[code]
dibUno.OnCursorEntered = function(self)
self:SetStretchToFit ( true )
self.hover = true
self:AlphaTo( 255, 0.25 )
surface.PlaySound( "garrysmod/ui_hover.wav" )
end
[/code]
Now, I've confirmed it DOES change the variable, as GetStretchToFit returns true when the cursor enters the object. However, the icon itself is not updating, and I'm not sure what to do. Anyone have any insight?
After looking at [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dimagebutton.lua[/url]
This is what I did.
Under my MouseEnter function I did:
[code]
self.m_Image:SetPos( 2, 2 )
self.m_Image:SetSize( self:GetWide() - 4, self:GetTall() - 4 )
[/code]
Under my MouseExit function I did:
[code]
self.m_Image:SizeToContents()
self.m_Image:Center()
[/code]
Along with setting StretchToFit.
Sorry, you need to Log In to post a reply to this thread.