Quantcast
WoWInterface - View Single Post - Enabling The Default UI Chat Copying Feature
View Single Post
05-24-20, 03:32 PM   #1
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
Enabling The Default UI Chat Copying Feature

I have recently gotten back into modding for a bit. I have been working to clean up and freshen up Prat as much as I can.

On the way I have discovered lots of new API's built into the game which are letting me do new and cool things.

I wanted to share this one, because I know how much the folks here like simple modifications. This one is so simple I was surprised myself.

Have a look at the demo first: https://www.screencast.com/t/OHH4fg97ul9U

There was a time where that would have been extremely difficult to implement. Luckily, Blizzard has done all the work. All you have to do is make a couple API calls to enable it!

Here is the code that I am using in Prat. If you copy/paste it to try it, leave off the "module:"


Lua Code:
  1. function module:EnterSelectMode(frame)
  2.     frame = frame or SELECTED_CHAT_FRAME
  3.  
  4.     frame:SetTextCopyable(true)
  5.     frame:EnableMouse(true)
  6.     frame:SetOnTextCopiedCallback(function(frame, text, num_copied)
  7.       frame:SetTextCopyable(false)
  8.       frame:EnableMouse(false)
  9.       frame:SetOnTextCopiedCallback(nil)
  10.     end)
  11.   end

I hope you find lots of uses for it!
  Reply With Quote