Thread Tools Display Modes
07-14-09, 05:20 PM   #1
Dwargh
A Theradrim Guardian
 
Dwargh's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 64
Displaying text/values on action Buttons

Hi, I'm new to lua. Did read and create the learning addons in the book "Hacking World of Warcraft" by Atlas author Dan Gilbert and PerfectRaid author James Whitehead II.

I know there are ways to display values to an actionbutton. I'd like to know how.
I have looked in the code of addons like Macaroon and Dr.Damage but I can't see/don't understand what have been done to what I want.

A code snippet with an explanation on how to do this would be great.

I also want to be able to add this text/value to a button no matter what action bar addon is being used. But that's something for later. For now I just want to be able to display a custom text on a button at a custom position.
  Reply With Quote
07-17-09, 06:37 AM   #2
Medii
A Murloc Raider
Join Date: Jul 2009
Posts: 5
You need to create a fontstring object and anchor it to the button.
For example if the action button's global name is ActionButton1 you would do something like:
Code:
local text = ActionButton1:CreateFontString(nil,"OVERLAY")
text:SetFont("Fonts\\FRIZQT__.TTF",12) -- font face and size
text:SetText("myText")

-- Here you place the text in the center of the button
text:SetPoint("CENTER",0,0)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Displaying text/values on action Buttons


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