Quantcast
How to handle the click of a 'link' - WoWInterface
Thread Tools Display Modes
07-25-16, 11:32 PM   #1
Hiketeia
An Aku'mai Servant
 
Hiketeia's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 33
How to handle the click of a 'link'

Probably really simple, pardon me please.

If a "link" (like an itemLink) is printed to the chat frame, when you click on it, it does something - for an item, it opens the tooltip, for pet, the modified one etc. - how do we trigger that something ourselves?

I'm using HandleModifiedItemClick() with an item button and I can ctrl-click it and it pops up in the dressing room. Doesn't seem to be a HandleItemClick() though? I assumed the "modified" was for the ctrl key?

Related to this, I'm trying to use the new "appearanceLink" from C_TransmogCollection and is it just me or when you click on those, does it not actually work right? I noticed it just regular in-game when looting epics the chat says such and such appear was added and if you click that it doesn't bring you to the correct appearance (just the section of the journal it seems?). If it is broken, I assume we have to wait for blizzard to fix that? But if we handle clicking the link like regular, it'll work when they do?

Thanks for your time.
  Reply With Quote
07-26-16, 04:12 AM   #2
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
SetItemRef(link, text, button, chatFrame) is what happens when you click a chat link, so you can prehook that to alter current behavior.

https://www.townlong-yak.com/framexml/beta/ItemRef.lua
__________________
Grab your sword and fight the Horde!
  Reply With Quote
07-26-16, 09:23 PM   #3
Hiketeia
An Aku'mai Servant
 
Hiketeia's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 33
Thanks for the reply. I didn't want to change anything, I just wanted to cause it to happen. I dug through ItemRef and just look the code I needed for now from there.

Is there any standard method to get the 'hyperlink' portion of the link out of the field? I was passing the full link, and the method I was using was only expecting the stuff between the |H and |h. I did a little string work but figured there should be a standard method for that?

As for the 'transmogappearance' type of link my issue turns out was filters. I had filters set, and their logic that goes to the right page for the item doesn't take that into account. Plus, I'm not using links to things which might not be visible to the particular toon you're on so that's clumsy too.
  Reply With Quote
07-27-16, 04:30 AM   #4
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
No function for the specific purpose I don't think. Just do match("|H(.-)|h").
__________________
Grab your sword and fight the Horde!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to handle the click of a 'link'

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