WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Tutorials & Other Helpful Info. (https://www.wowinterface.com/forums/forumdisplay.php?f=12)
-   -   Enabling The Default UI Chat Copying Feature (https://www.wowinterface.com/forums/showthread.php?t=58022)

sylvanaar 05-24-20 03:32 PM

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!


All times are GMT -6. The time now is 12:57 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI