Derman menu sounds

hi guys a quick question. I have been thinking if this was possible to do, if so how possible.

I would like to add a sound so that when ever a user hovers over a button it will a sound. If not that then a sound when it is pressed. Does anyone have an example with how they would go about it? This would be for a Derma menu.

I would be very grateful for any help as I expect I could apply this to many other things as well.

Many thanks.



Something like this maybe:

local button = vgui.Create( "DButton" )

button.OnCursorEntered = function()
    surface.PlaySound( hover_sound )

button.DoClick = function()
    surface.PlaySound( pressed_sound )

Ah perfect thanks! I will give this a go. I presume that if I am using custom sounds I will just use the file directory with a local variable and then call the variable for the surface.Play sound?