Drag and drop functions not working after i add "OnMousePressed" function.
How i fix this problem ?
It would be more helpful if you describe your problem more specific, so we can understand you‘re problem.
I add function
function PANEL:OnMousePressed(keyCode)
end
to my custom panel because i need this function.
After i add this function, this library
Panel:Receiver,
Panel:Droppable and etc
Wont work for me
Dragndrop probably uses PANEL:OnMousePressed so you'd need to call the parents PANEL:OnMousePressed if you want this to work
Ok, how can i do this ?
Bump
Bump
Personally, when I need to call a parent function, I use for example:
[lua]
function PANEL:PerformLayout(w, h)
-- My stuff here
DPanel.PerformLayout(self, w ,h)
end
[/lua]
Because my "Custom Panel" is derived from DPanel.
If your "MyCustomPnl" is derived from DButton, it should look like this (not tested, but you get the idea):
[lua]
local button = vgui.Create( "MyCustomPnl" )
button:SetText( i )
button:SetSize( 36, 24 )
button:Dock( TOP )
button:Droppable( "myDNDname" )
button.OnMousePressed = function(s , k)
-- some shit code.
DButton.OnMousePressed(s, k)
end
[/lua]
This is work, thank you.
Sorry, you need to Log In to post a reply to this thread.