Reply
Thread Tools Display Modes
Unread 03-27-13, 08:35 AM   #1
fRodzet
A Flamescale Wyrmkin
Join Date: Mar 2013
Posts: 114
Help with ModifiedClick bindings

Greetings,

Lua Code:
  1. -- create a table which contains the index you'd like to show in your tooltip
  2. local supportedIndexType = {
  3.     item = true,
  4.     achievement = true,
  5.     quest = true,
  6.     unit = true,
  7.     enchant = true,
  8.     spell = true,
  9.     talent = true,
  10.     glyph = true,
  11.     }
  12. -- create a function which contains the scripts necessary to display the tooltip we need
  13. local function ChatlinkTooltip_Show(self, linkData)
  14.     local linkType = string.match(linkData, "(.-):")
  15.         if supportedIndexType[linkType] then
  16.             GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
  17.             GameTooltip:SetHyperlink(linkData)
  18.             GameTooltip:Show()
  19.         end
  20. end
  21.  
  22. for frameType = 1, NUM_CHAT_WINDOWS do
  23.     local chatType = _G["ChatFrame" .. frameType]
  24.         chatType:HookScript("OnHyperLinkEnter", ChatlinkTooltip_Show)
  25.         chatType:HookScript("OnHyperLinkLeave", GameTooltip_Hide)  
  26. end

This is my lua code so far, i then added a ModifiedClick binding to the bindings.xml:

Lua Code:
  1. <Bindings>
  2.     <ModifiedClick action="COMPAREITEMS" default="SHIFT"/>
  3. </Bindings>

But it doesn't work the proper way, i know that i miss something in my lua code to make it show properly.

If i hold down shift before i enter the link in the chat, the tooltip for both the one in chat and the one i have equipped shows.. However, if i'm at my link and i click shift, nothing happends. How can i make this possible, thanks?
fRodzet is offline   Reply With Quote
Unread 03-27-13, 02:04 PM   #2
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,288
Code:
ItemRefTooltip:SetScript("OnTooltipSetItem", function(self, ...)
	if IsShiftKeyDown() then
		GameTooltip_ShowCompareItem(self, 1)
		self.comparing = true
	else
		self.comparing = nil
	end
end)
According to the code in tekKompare, you also need to have some extra hooks to prevent issues, since the ItemRefTooltip isn't really designed to work with compare tooltips:

Code:
ItemRefTooltip:SetScript("OnEnter", nil)
ItemRefTooltip:SetScript("OnLeave", nil)
ItemRefTooltip:SetScript("OnDragStart", function(self)
	ItemRefShoppingTooltip1:Hide()
	ItemRefShoppingTooltip2:Hide()
	ItemRefShoppingTooltip3:Hide()
	self:StartMoving()
end)
ItemRefTooltip:SetScript("OnDragStop", function(self)
	self:StopMovingOrSizing()
	ValidateFramePosition(self)
	if self.comparing then
		GameTooltip_ShowCompareItem(self, 1)
	end
end)
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 03-27-13, 02:11 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,597
If you hold shift while clicking on an item link in chat, there are new compare tips that will appear with it. They are called ItemRefShoppingTooltip1-3.

/edit: maybe I misunderstood - but I'll leave this here, since many people don't realize this is in the game
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline   Reply With Quote
Unread 03-27-13, 02:33 PM   #4
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,288
He said the compare tooltips show up with Shift when hovering -- that's the behavior you're thinking of, Seerah. The problem he's having is getting them to show up with the tooltip that appears when you click on a link in chat -- that's the ItemRefTooltip, which doesn't support comparing by default.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 03-27-13, 02:43 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,597
No, when you shift-click an item link in chat now, you get the compare tips attached to the regular itemreftooltip open on your screen. I found this recently when updating TipTop and added them to the addon to be skinned. They weren't in the game previously.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Lua/XML Help » Help with ModifiedClick bindings

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