Forum:Create tabbed buttons with LUA

hi guys!

i want to create a frame, and that frame has 2 tabbed buttons with OptionsFrameTabButtonTemplate inheritance with pure LUA

and here is my half code:

local MF = CreateFrame("Frame","MYmainFrame",UIParent); MF:SetFrameStrata("DIALOG"); MF:SetWidth(700); MF:SetHeight(524); MF:SetBackdrop({bgFile = "Interface/DialogFrame/UI-DialogBox-Background", edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", tile = true, tileSize = 32, edgeSize = 32,  insets = { left = 11, right = 12, top = 12, bottom = 11 }}); MF:SetBackdropColor(0,0,0,1); MF:SetPoint("CENTER",0,0); local MF_titleBG = MF:CreateTexture(nil,"ARTWORK"); MF_titleBG:SetTexture("Interface/DialogFrame/UI-DialogBox-Header"); MF_titleBG:SetWidth(280); MF_titleBG:SetHeight(64); MF_titleBG:SetPoint("TOP", MF, 0, 12); MF.texture = MF_titleBG; local MF_titleText = MF:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall"); MF_titleText:SetText('The Title'); MF_titleText:SetPoint("TOP", MF, 0, -3); local Tab_1 = CreateFrame('Button', "$parentTab1", MF, "OptionsFrameTabButtonTemplate"); Tab_1:SetID(1); Tab_1:SetText('tab one'); Tab_1:SetPoint("CENTER", MF, "TOPLEFT", 100, -50); local Tab_2 = CreateFrame('Button', "$parentTab2", MF, "OptionsFrameTabButtonTemplate"); Tab_2:SetID(1); Tab_2:SetText('tab two'); Tab_2:SetPoint("LEFT", Tab_1, "RIGHT", -16, 0); MF:Show;

...as you see i should append the OnLoad event script and of course the content of the 2 tab references and other things but i am a novice and i don't know exactly how to properly do this... at that current state the 2 tabs shown properly but the frames aren't fitted to the text of the tabs... please help me guys at this.

thank you!

--RichardCANE (talk) 14:18, October 30, 2009 (UTC)