Thread Tools Display Modes
04-13-15, 06:12 PM   #1
aapoo
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2008
Posts: 14
Which widget for text on screen?

Hello,

I've been working on an addon and I cannot figure out a neat way to display a list, similar to how the questframe/watchframe looks is what I'm going for. I'm using ACE3 so I can focus on the fun part and less about the UI, however I am obviously willing to step out of that if needed.

It needs to display 5-15 items / rows of text and I need to be able to set the color of the text per line in a simple manner.

Any ideas? =)
  Reply With Quote
04-13-15, 10:35 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
A frame with 5-15 fontstrings.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-14-15, 04:12 AM   #3
aapoo
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2008
Posts: 14
How in the hell did I not think about fontstrings >_< Feeling quite stupid. ANyways thanks for pointing out what was right infront of me

Are there any good tutorials for Fontstrings? I've looked at the API and spent about a hour trying to get it to work, but whatever I do i don't get any information printed to a frame. I've made sure the frame exists and so on.

Last edited by aapoo : 04-14-15 at 07:54 AM.
  Reply With Quote
04-14-15, 07:07 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Just like frames and other objects, a fontstring needs to either use a template (an existing font object) or have visual properties set in order for you to be able to see it.

Here's a simple, barebones example.
Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetPoint("CENTER")
  3. local text = f:CreateFontString(nil, nil, "GameFontNormal")
  4. text:SetPoint("CENTER")
  5. text:SetText("Hello!")

If you are having other problems, we will need to see your code. (We're not psychic. )
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-16-15, 12:56 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Outside of syntax errors, the most common cause of things "not appearing" is a lack of anchors and/or dimensions. A UI object must have at least one anchor (using SetPoint) and either explicitly set dimensions (using SetSize/SetWidth/SetHeight) or dimensions implied by using multiple anchors (eg. TOPLEFT and BOTTOMRIGHT).

And speaking of syntax errors, make sure you have some kind of error display at all times while writing addons. The default UI hides them by default, and even if you turn on the "Show Lua Errors" option it still has some deficiencies -- a big one being the fact that it can't show errors that happen too early in the loading process, which is exactly where syntax errors happen.

Or if you have Lua installed on your computer, you can run "luac -p your_file_here.lua" from the command line to check for syntax errors. If you're using an IDE with support for Lua, it may have this feature built in.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Which widget for text on screen?


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