View Single Post
02-19-11, 12:09 AM   #19
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Okay, using your example of :
Code:
local HelpHeaders = {
--button name = bulk help text
['General'] = 'blahblahgeneral',
['Buttons'] = 'blahblahbuttons',
['Frame Mover'] = 'blahblahmover',
['Chat'] = 'blahblahchat',
['Tooltips'] = 'blahblahtooltips',
['Unit Frames'] = 'blahblahunitframes',
['Backpack'] = 'blahblahbakpak',
['DashBoard'] = 'blahblahdashboard',
['HUD'] = 'blahblahhud',
['Development'] = 'blahblahdevtools',
}
To get this to create a button for each caption:
Code:
for name,caption in pairs(HelpHeaders) do
     LeftScrollBar.scrollChild.button = LeftScrollBar.scrollChild.button or {}
     LeftScrollBar.scrollChild.button[name] = CreateFrame('button', "HHeaderButton" .. name, LeftScrollBar.scrollChild)
     LeftScrollBar.scrollChild.button[name].text = LeftScrollBar.scrollChild.button[name]:CreateFontString("HHeaderButtonText" .. name, 'DIALOG')
    LeftScrollBar.scrollChild.button[name].text:SetFont([[Fonts\FRIZQT__.TTF]], 14)
LeftScrollBar.scrollChild.button[name].text:SetPoint("CENTER", LeftScrollBar.scrollChild.button[name], "CENTER", 0, 0)
   LeftScrollBar.scrollChild.button[name].text:SetTextColor(.50, .90, .80, 1)
   LeftScrollBar.scrollChild.button[name].text:SetText(caption)
end
This would cycle through your list and create a button for each item. So that the table would look like this:

LeftScrollBar.scrollChild.button["General"] with text as 'blahblahgeneral'
LeftScrollBar.scrollChild.button['Buttons'] with text as 'blahblahbuttons'
LeftScrollBar.scrollChild.button['Frame Mover'] with text as 'blahblahmover'
LeftScrollBar.scrollChild.button['Chat'] with text as 'blahblahchat'
LeftScrollBar.scrollChild.button['Tooltips'] with text as 'blahblahtooltips'
LeftScrollBar.scrollChild.button['Unit Frames'] with text as 'blahblahunitframes'
LeftScrollBar.scrollChild.button['Backpack'] with text as 'blahblahbakpak'
LeftScrollBar.scrollChild.button['DashBoard'] with text as 'blahblahdashboard'
LeftScrollBar.scrollChild.button['HUD'] with text as 'blahblahhud'
LeftScrollBar.scrollChild.button['Development'] with text as 'blahblahdevtools'

LeftScrollBar.scrollChild.button['Development'] of course can also be accessed by using LeftScrollBar.scrollChild.button.Development after it is created but during the creation routine it needs to be in the [] due to it being a variable and not a physical string.

Hopefully that will be enough for you to see what may need changing in your code to get it to do what you want. Just replace the value with the variable that holds the value you want displayed.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 02-19-11 at 12:34 AM.
  Reply With Quote