Posted by modder_hell on Fri, 08 Oct 2010 07:51:38
I have a problem I was hoping you could help me solve. My mod has a frame with a custom EditBox in it, & I wanted to be able to shift-click a profession in my spellbook & have it link like it does when you shift-click a profession into your chat frame.
Any idea how to go about this?
The closest I got was trying to create my own custom links, such as:
It creates a link, but the link is only the Jewelcrafting tooltip. I wanted to link my actual profession, so that it brings up my recipes etc. Also, creating my own links dynamically would be much harder than just having the link appear in my EditBox when it is shift-clicked :(
I also had a brief look through ChatFrame.lua, but have no idea what's going on in those millions of lines of code :p
Posted by jnwhiteh on Fri, 08 Oct 2010 08:47:57
Securehook the click of the profession button and get the link using the API (you do NOT have to construct your own, just use the API to get it) and insert the link into your editbox, if your editbox has focus. Some pseudo-code:
hooksecurefunc(someFunction, function() if myEditBox:HasFocus() then link = SomeAPIToGetLink() myEditBox:InsertText(link) end end)
The live version of Clique has code to do this, just search for HasFocus().
Posted by modder_hell on Fri, 08 Oct 2010 11:03:11
wow that worked like a charm :D Thank you so much!
I should mention that 'Beginning LUA with World of Warcraft' is by FAR my favourite book to read. ^_^
Posted by jnwhiteh on Fri, 08 Oct 2010 13:10:31
Unless I'm mistaken, that's not my book (or the book associated with this site), but I'm glad you're enjoying it nonetheless =)