• Tooltip's staying after closing derma menu
    6 replies, posted
How can you make the little tooltip disappear after you close a custom derma menu? You can see what problem I am having by looking at the 2 following screenshots: Menu opened: [IMG]http://cloud.steampowered.com/ugc/596958051312003921/81E95BBCC73690BBE15A6B40CD70F15EB94E0E14/[/IMG] Menu closed: [IMG]http://cloud.steampowered.com/ugc/596958051311999986/5B1BC03B7E7982D6A8D0F85D3F2AA2B7CEAFBE16/[/IMG]
Are you hiding the menu or removing it?
When you click on the spawnicon, print it's GetTable (There should be a .Items) Loop through .Items, and you should get all the tooltips. Remove them manually.
[QUOTE=_nonSENSE;34047669]Are you hiding the menu or removing it?[/QUOTE] Using Frame1:Close().
Just run Tooltip:Remove();Tooltip = nil; Of course with your tooltip object.
Oh right, didn't add any lua extracts to code, here: [lua] function SpawnVehicle_Menu( ply, close ) if close then Frame:Close() return end local Frame = vgui.Create( "DFrame" ) Frame:SetTitle("Buy Vehicles!") Frame:SetSize( ScrW() * 0.065, ScrH() * 0.25 ) Frame:Center() Frame:SetVisible( true ) Frame:SetDraggable( true ) Frame:SetSizable( false ) Frame:ShowCloseButton ( false ) Frame:MakePopup() function RP_CloseSpawnMenu() if (LocalPlayer():Team() == 3) then Frame:Close() end end hook.Add( "OnSpawnMenuClose", "RP_CloseSpawnMenu", RP_CloseSpawnMenu) for i=1,#Vehicles.Class do local Icon = vgui.Create( "SpawnIcon", Frame) Icon:SetPos( ScrW() * 0.01, ScrW() * 0.01 + (i*(ScrW() * 0.06)) - (ScrW() * 0.045) ) Icon:SetIconSize((ScrW() + ScrH()) * 0.03 ) Icon:SetModel( Vehicles.Model[i] ) Icon:SetToolTip( "$".. Vehicles.Cost[i] ) Icon.DoClick = function() RunConsoleCommand("rp_vehiclespawn", Vehicles.Class[i] ) end end end [/lua]
[lua]function SpawnVehicle_Menu( ply, close ) if close then Frame:Close() return end local Frame = vgui.Create( "DFrame" ) Frame:SetTitle("Buy Vehicles!") Frame:SetSize( ScrW() * 0.065, ScrH() * 0.25 ) Frame:Center() Frame:SetVisible( true ) Frame:SetDraggable( true ) Frame:SetSizable( false ) Frame:ShowCloseButton ( false ) Frame:MakePopup() function RP_CloseSpawnMenu() if (LocalPlayer():Team() == 3) then Frame:Close() end end hook.Add( "OnSpawnMenuClose", "RP_CloseSpawnMenu", RP_CloseSpawnMenu) local icons = {} for i=1,#Vehicles.Class do local Icon = vgui.Create( "SpawnIcon", Frame) Icon:SetPos( ScrW() * 0.01, ScrW() * 0.01 + (i*(ScrW() * 0.06)) - (ScrW() * 0.045) ) Icon:SetIconSize((ScrW() + ScrH()) * 0.03 ) Icon:SetModel( Vehicles.Model[i] ) Icon:SetToolTip( "$".. Vehicles.Cost[i] ) Icon.DoClick = function() RunConsoleCommand("rp_vehiclespawn", Vehicles.Class[i] ) end table.insert(icons,Icon) end Frame.Close = function() for k , v in pairs(icons) do if v:IsValid() then v:Remove() end end return DFrame.Close(Frame) end end[/lua] [editline]4th January 2012[/editline] Hacky but should work.
Sorry, you need to Log In to post a reply to this thread.