Thread Tools Display Modes
03-27-15, 12:40 PM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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 :-)
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-29-15, 11:24 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You may want to look at Bartender4 to see how it implements this feature.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
03-30-15, 12:49 AM   #3
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
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...
  Reply With Quote
03-30-15, 11:43 AM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
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
__________________

Last edited by MunkDev : 03-30-15 at 12:01 PM.
  Reply With Quote
03-31-15, 11:52 PM   #5
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
04-03-15, 12:54 AM   #6
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » ActionBar ToolTipDisable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off