WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   ActionBar ToolTipDisable (https://www.wowinterface.com/forums/showthread.php?t=52130)

gmarco 03-27-15 12:40 PM

ActionBar ToolTipDisable
 
Hi all,

I am asking if someone knows a very simple addon that can enable/disable tooltips on actionbars (it is not necessary it does it automagically in combat by itself, I can do manually :-)

I am asking because I am using a very cute, but simple actionbars addon that doesn't support this features and I really like to have it.

I have found a macro that do it and it works but it disables ALL the GameTooltip not only the actionbars ones.

Lua Code:
  1. /script GameTooltip.Temphide = function() GameTooltip:Hide() end; GameTooltip:SetScript("OnShow", GameTooltip.Temphide)
  2.  
  3. /stopmacro [btn:1]
  4.  
  5. /script GameTooltip:SetScript("OnShow", GameTooltip.Show);

I am trying to write a little addon myself but due the fact I have limited time in these days and also I don't have understood so much the GameTooltip frame I am still far from finishing. I'll ask later in the right area if there is nothing ready to be used :-)

Thanks :-)

Phanx 03-29-15 11:24 PM

You may want to look at Bartender4 to see how it implements this feature.

Dridzt 03-30-15 12:49 AM

Lua Code:
  1. local UnitAffectingCombat, InCombatLockdown = UnitAffectingCombat, InCombatLockdown
  2.  
  3. local function hide(self)
  4.     if TipBeGone.CombatOnly then
  5.         if (UnitAffectingCombat("player") or UnitAffectingCombat("pet") or InCombatLockdown()) then
  6.             self:Hide()
  7.         end
  8.     else
  9.         self:Hide()
  10.     end
  11. end
  12.  
  13. local function thide(self)
  14.     hide(GameTooltip);
  15. end
  16.  
  17. -- Hide tooltips for actions, pet actions and shapeshift
  18. if TipBeGone.ActionBar then
  19.     hooksecurefunc(GameTooltip, "SetAction", hide);
  20. end
  21. if TipBeGone.PetActionBar then
  22.     hooksecurefunc(GameTooltip, "SetPetAction", hide);
  23. end
  24. if TipBeGone.ShapeShiftBar then
  25.     hooksecurefunc(GameTooltip, "SetShapeshift", hide);
  26. end
  27.  
  28. -- Hide tooltips for inventory items (paper doll and inspect)
  29. if TipBeGone.Inventory then
  30.     hooksecurefunc(GameTooltip, "SetInventoryItem", hide);
  31. end
  32.  
  33. -- Hide tooltips on micro buttons
  34. if TipBeGone.MainBar then
  35.     CharacterMicroButton:HookScript("OnEnter", thide)
  36.     SpellbookMicroButton:HookScript("OnEnter", thide)
  37.     TalentMicroButton:HookScript("OnEnter", thide)
  38.     QuestLogMicroButton:HookScript("OnEnter", thide)
  39.     MainMenuMicroButton:HookScript("OnEnter", thide)
  40.     PVPMicroButton:HookScript("OnEnter", thide)
  41.     SocialsMicroButton:HookScript("OnEnter", thide)
  42.     GuildMicroButton:HookScript("OnEnter", thide) -- Cataclysm
  43.     LFDMicroButton:HookScript("OnEnter", thide)
  44.     HelpMicroButton:HookScript("OnEnter", thide)
  45.     AchievementMicroButton:HookScript("OnEnter", thide)
  46. end
  47.  
  48. -- Hide tooltips on bag and keyring buttons
  49. if TipBeGone.Bags then
  50.     MainMenuBarBackpackButton:HookScript("OnEnter", thide);
  51.     CharacterBag0Slot:HookScript("OnEnter", thide);
  52.     CharacterBag1Slot:HookScript("OnEnter", thide);
  53.     CharacterBag2Slot:HookScript("OnEnter", thide);
  54.     CharacterBag3Slot:HookScript("OnEnter", thide);
  55.     KeyRingButton:HookScript("OnEnter", thide);
  56. end
Maybe something like this...

MunkDev 03-30-15 11:43 AM

Lua Code:
  1. GameTooltip.HideAction = true
  2.  
  3. function GameTooltip:ToggleAction()
  4.    self.HideAction = not self.HideAction
  5. end
  6. GameTooltip:HookScript("OnShow", function(self)
  7.       local actionButton = self:GetOwner() and self:GetOwner().HotKey
  8.       if actionButton and self.HideAction then
  9.          self:Hide()
  10.       end
  11. end)
Toggle it on/off using:
Lua Code:
  1. /run GameTooltip:ToggleAction()
Here's the whole thing in macro format. Pressing it will toggle on/off:
Lua Code:
  1. /run local t=GameTooltip if t.HideAB~=nil then t.HideAB=not t.HideAB else t.HideAB=true t:HookScript("OnShow", function(s) local a = s:GetOwner() and s:GetOwner().HotKey if a and s.HideAB then s:Hide() end end) end

gmarco 03-31-15 11:52 PM

Thanks very much for both code samples.

I have checked them and they seems to works fine.
I'll try to study and understand better them to build a minimal addon around this code.

Thanks again.

Really much appreciated.

gmarco 04-03-15 12:54 AM

Hi munkdev,

I tried your code and it works really nice out of the box. Now I am trying to implement and addon that use it on automagically swap tooltip state on combat base.

But I have some problems so I am starting a discussion on the right forum:
http://www.wowinterface.com/forums/s...ad.php?t=52151

Thanks very much again.


All times are GMT -6. The time now is 12:45 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI