Thread Tools Display Modes
02-19-11, 08:11 AM   #21
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,935
If you had the table set up as something as follows:

Code:
ButtonCaptions = {
    [1] = "General",
    [2] = "Money",
    [3] = "Food",
    [4] = "Alchemy",
    etc
}
or perhaps just  
ButtonCaptions = {
    "General",
    "Money",
    "Food",
    "Alchemy",
    etc
}
Yeah possibly that, been awhile since I did a pure text list table.
Then you would access it as:

Code:
for index,value in ipairs(ButtonCaptions) do
     button[index] = button[index] or {}
     button[index] = CreateFrame("Button","Button"..index,...)
     button[index].Text = CreateFontString("ButtonText"..index,...)
     button[index].Text:SetText(value)
end
Obviously that isn't every line you need but it should be enough for you to see what is different.
__________________


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
  Reply With Quote
02-19-11, 11:45 PM   #22
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
well i got it all working except for one thing. lol. not sure what to do about setpoints without using the actual names haha.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-20-11, 01:26 AM   #23
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,935
FrameReference:SetPoint("CENTER",LinkedFrameReference,"CENTER",0,0)

It would wholly depend on how you were planning on displaying them. Here is an example from one of my current projects that positions buttons underneath each other.

because lastButton is nil when the first button is made that is coded to set the top most position. The rest all simply follow suit. This example has a button that isn't clickable but has a hover script for the tooltip and has an icon and 3 lines of text.

Code:
	frame.Buttons = {}
	local lastButton
	for i,v in pairs(XGlyphLibraryDB) do
		if ( v.GlyphID and not v[currentPlayer]) then
			local button = CreateFrame("Button","$parent_Button_"..v.GlyphID,frame.scrollChild)
			button:SetHeight(GLYPH_BUTTON_HEIGHT);
			button:SetWidth(frame.scrollChild:GetWidth())
			
			button.ShowTooltip = function(self)
				GameTooltip:SetOwner(self, "ANCHOR_CURSOR");
				GameTooltip:SetGlyphByID(v.GlyphID)
				GameTooltip:AddLine(v.Class, 1.0,1.0,1.0)
				GameTooltip:Show();
			end

			button.HideTooltip = function(self)
				GameTooltip:Hide();
			end			
			
			button:SetScript("OnEnter",function(self) self:ShowTooltip() end);
			button:SetScript("OnLeave",function(self) self:HideTooltip() end);
			
			
			button.icon = button:CreateTexture("$parent_Icon","ARTWORK");
			button.icon:SetTexture(v.GlyphIcon);
			button.icon:SetWidth(GLYPH_BUTTON_HEIGHT - 4)
			button.icon:SetHeight(GLYPH_BUTTON_HEIGHT - 4)
			button.icon:SetPoint("TOPLEFT",5,-5)
			
			button.title = button:CreateFontString("$parent_Title","ARTWORK");
			button.title:SetFontObject("GameFontNormal")
			button.title:SetText(v.GlyphName)
			button.title:SetJustifyH("LEFT")
			button.title:SetJustifyV("MIDDLE")
			button.title:SetPoint("TOPLEFT",button.icon,"TOPRIGHT",5,0)
			button.title:SetPoint("TOPRIGHT",button,"TOPRIGHT")
						
			button.class = button:CreateFontString("$parent_Class", "ARTWORK");
			button.class:SetFontObject("GameFontNormal")
			button.class:SetText(v.Class)
			button.class:SetJustifyH("LEFT")
			button.class:SetJustifyV("MIDDLE")
			button.class:SetPoint("BOTTOMLEFT",button.icon,"BOTTOMRIGHT",5,0)
			button.class:SetPoint("BOTTOMRIGHT",button,"BOTTOMRIGHT")
			
			button.type = button:CreateFontString("$parent_Type", "ARTWORK");
			button.type:SetFontObject("GameFontNormal")
			button.type:SetText(GLYPH_TYPE_NAME[v.GlyphType])
			button.type:SetJustifyH("LEFT")
			button.type:SetJustifyV("MIDDLE")
			button.type:SetPoint("LEFT",button.icon,"RIGHT",5,0)
			button.type:SetPoint("CENTER",button.icon,"CENTER")
			
			if ( not lastButton ) then 
				button:SetPoint("TOPLEFT",frame.scrollChild,"TOPLEFT")
			else
				button:SetPoint("TOPLEFT",lastButton,"BOTTOMLEFT")
			end
			
			lastButton = button
			
			button.icon:Show()
			button:Show();
			tinsert(frame.Buttons,button)
		end
	end
end
__________________


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
  Reply With Quote
02-20-11, 01:31 AM   #24
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
I figured it out this is what i ended up with... now my last question is... is there anyway to make chunks of text automatically decide to use \n based on the width of the frame?
heres what i ended up with in my for statement. works great.

Code:
local anchorFrame, anchorPoint = LeftScrollBar.scrollChild, 'TOP'
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]:SetHeight(15)
	LeftScrollBar.scrollChild.button[name]:SetWidth(90)
	LeftScrollBar.scrollChild.button[name]:RegisterForClicks("AnyUp")
	
	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]:SetScript('OnEnter', function()
		LeftScrollBar.scrollChild.button[name].text:SetTextColor(.80, .50, .50, 1)
	end)

	LeftScrollBar.scrollChild.button[name]:SetScript('OnLeave', function()
		LeftScrollBar.scrollChild.button[name].text:SetTextColor(.50, .90, .80, 1)
	end)
	LeftScrollBar.scrollChild.button[name]:SetScript('OnClick', function()
		RightScrollBar.scrollChild.text:SetText(caption)
	end)
	
	LeftScrollBar.scrollChild.button[name]:SetPoint("LEFT", LeftScrollBar.scrollChild, "LEFT", 15, 0)


	LeftScrollBar.scrollChild.button[name].text:SetText(name)
	
	local buttons = LeftScrollBar.scrollChild.button[name]
	
	buttons:SetPoint('TOP', anchorFrame, anchorPoint, 0, -7)
	
	anchorFrame, anchorPoint = buttons, 'BOTTOM'
	
end
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
02-20-11, 10:17 AM   #25
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,935
Take a reader through this page and it may help you understand how you can get that to work.


http://www.wowpedia.org/UIOBJECT_FontString


Basically you make sure you anchor at least the TOPLEFT and then define a width. The text will wrap. Define a height and it will cut off at the bottom instead of overflowing.

If the fontstring is in a scrolling frame then defining the width and setting the scrollsize to a good number you can scroll through a reasonable amount of text. although there is probably a finite amount of text it can hold.
__________________


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
  Reply With Quote
02-20-11, 11:23 AM   #26
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
duh, i knew that already lol first time ever making text long enough that it needed to be wrapped lol.

All works perfect, thanks for all the help!
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Scrolling frames.


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