Quantcast
Tab Issues - WoWInterface
Thread Tools Display Modes
07-06-21, 05:01 AM   #1
Jumpercable
A Murloc Raider
Join Date: Jan 2021
Posts: 7
Tab Issues

Hi all, im having issues creating tabs in LUA. Ive been working on moving my addon ( EZ Mount ) from using a mix of xml/lua to just lua.

However i am running into issues with my tab set up and have tried so many things but cannot figure out whats going wrong. My buttons are messing up by overlapping each other when i first go into the interface->addon panel. They also seem to fix themselves when I leftclick the addon name on the left hand side of the addon panel ( where you can select different addons ). There is almost no resources on the net for using wows built in tabs that are just lua, the ones Ive seen are xml/lua and are out dated. Anyone able to pinpoint what I am missing?

Click image for larger version

Name:	eztest1.jpg
Views:	64
Size:	5.1 KB
ID:	9653

Here is my addon link on curse: https://www.curseforge.com/wow/addons/ez-mount

Here is the code im using for testing lua frames
.TOC
Lua Code:
  1. ## Interface: 90100
  2. ## Title: EZ Test
  3. ## Version: 1.2.2
  4. ## Author: Jumpercable
  5. ## Notes: Mount addon.
  6. ## SavedVariablesPerCharacter: EZTestData
  7. EZTFrames.lua
  8. EZ Test.lua

EZ Test.lua
Lua Code:
  1. EZTest      = CreateFrame("Button","EZMount",UIPARENT,"SecureActionButtonTemplate")
  2.  
  3.  
  4.  
  5. function EZM_ChkButton(self,button,state)
  6. end
  7.  
  8. function EZM_ColorCustom(self)
  9.   print(self:GetName())
  10. end
  11.  
  12. function EZM_ColorDefault(self)
  13.   print(self:GetName())
  14. end
  15.  
  16. function EZM_ChkRadio(self)
  17.   print(self:GetName())
  18. end
  19.  
  20. function EZT_CheckMountTxt(self)
  21.   print(self:GetText())
  22. end
  23.  
  24. function EZT_ChangeTab(self,tbl)
  25.   for i = 1 , #tbl do
  26.     if self:GetName() == tbl[i]:GetName() then
  27.       PanelTemplates_SetTab(EZTC, i)
  28.       tbl[i]:Show()
  29.     else
  30.       tbl[i]:Hide()
  31.     end
  32.   end
  33. end
  34.  
  35. function EZM_DropDownLoad(self)
  36.   items = {"None","Random","Favorite","Passenger","Class","Covenant","Mount Off","Selection","Specific","Latest"}
  37.     for i=1, #items do
  38.     info = UIDropDownMenu_CreateInfo()
  39.         info.text = items[i];
  40.         info.value = i;
  41.     info.colorCode = "|c99FEFEFE"
  42.         info.func = function()
  43.       UIDropDownMenu_SetSelectedValue(self,i)
  44.       --EZM_SelectionValue(txtFrame,items[i])
  45.       --EZM_TabUpdater()
  46.      end
  47.         UIDropDownMenu_AddButton(info)
  48.     end
  49.   UIDropDownMenu_SetWidth(self, 100)
  50. end
  51.  
  52. function EZT_TabUpdater()
  53.  --- Get Button Sizes and clear all points
  54.  Frame_TabWidths = {}
  55.  Frame_TotalWidth = 0
  56.  for i = 1,5 do
  57.     Frame_TabWidths["EZTCTab"..i] = getglobal("EZTCTab"..i):GetWidth() - 20
  58.     getglobal("EZTCTab"..i):ClearAllPoints()
  59.  end
  60.  --- Tab Location Builder
  61.  for i=1, 5 do
  62.    getglobal("EZTCTab"..i):ClearAllPoints()
  63.      Frame_TotalWidth = Frame_TotalWidth + Frame_TabWidths["EZTCTab"..i]
  64.      if i == 1 then
  65.        Frame_Link = "EZTC"  
  66.        Frame_Pos1 = "TOPLEFT"
  67.        Frame_Pos2 = "BOTTOMLEFT"
  68.        Frame_X = -9
  69.        Frame_Y = 3
  70.      else
  71.        Frame_Link = "EZTCTab"..i-1
  72.        Frame_Pos1 = "LEFT"
  73.        Frame_Pos2 = "RIGHT"
  74.        Frame_X = -19
  75.        Frame_Y = 0
  76.        if i == 5 then Frame_NextLink = "EZMCTab5" end
  77.      end
  78.    --- SET FRAME LOCATION
  79.    getglobal("EZTCTab"..i):SetPoint(Frame_Pos1, Frame_Link, Frame_Pos2, Frame_X, Frame_Y)
  80.  end
  81. end
  82.  
  83. Create_ConfigFrame()
  84. EZT_TabUpdater()  
  85. EZT_ChangeTab(EZTC_1,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5})
  86.  
  87.  
  88.  
  89. EZTest:SetScript("OnEvent",function(self,event,...)
  90.   if event=="ADDON_LOADED" then
  91.     if ... == "EZ Test" then
  92.      
  93.     end
  94.   end
  95.   if event=="PLAYER_LOGIN" then
  96.  
  97.   end
  98. end)
  99. EZTest:RegisterEvent("ADDON_LOADED")
  100. EZTest:RegisterEvent("PLAYER_ENTERING_WORLD")
  101. EZTest:RegisterEvent("PLAYER_LOGIN")

EZTestFrames.lua
Lua Code:
  1. --------------------------------------------------------------------
  2. --- FUNCTIONS FOR BUILDING FRAMES, BUTTONS, CHECKBOX'S AND OTHER ---
  3. --- UI ELEMENTS. ALSO INCLUDES OTHER FUNCTIONS THAT ARE USED     ---
  4. --- COMMONLY THROUGHOUT EZ Mount                                 ---
  5. --------------------------------------------------------------------
  6. local EZMTitle = "|cFF3d0cedE|cFF0c2eedZ |cFF0c6aedM|cFF0c88edO|cFF0cadedU|cFF0cd6edN|cFF0ceddaT"
  7. local EZMVer   = "2.3.0"
  8. -----------------------------------------------------
  9. --- BUILD FRAMES / TEXT / BUTTONS ETC             ---
  10. -----------------------------------------------------
  11. function Create_Text(Frame,Name,SizeX,SizeY,Text,Points,JustifyH,JustifyV,Colors,Font)
  12.   local Let = getglobal(Frame):CreateFontString(Name, "OVERLAY", Font) --nil replace with text, need to get name
  13.   if SizeX then Let:SetSize(SizeX, SizeY) end
  14.   if type(Points) == "table" then
  15.     for _,V in pairs(Points) do
  16.       if V.RelF then
  17.         Let:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  18.       else
  19.         Let:SetPoint(V.Point, V.X, V.Y)
  20.       end
  21.     end
  22.   end
  23.   if JustifyH then Let:SetJustifyH(JustifyH) end
  24.   if JustifyY then Let:SetJustifyV(JustifyV) end
  25.   if type(Colors) == "table" then
  26.     if Colors.Type == 255 then
  27.       Let:SetTextColor(Colors.R*(1/255),Colors.G*(1/255),Colors.B*(1/255),Colors.A or nil)
  28.     else
  29.       Let:SetTextColor(Colors.R,Colors.G,Colors.B, Colors.A or nil)
  30.     end
  31.   end    
  32.   Let:SetText(Text)
  33. end
  34. function Create_Line(frame,SizeX,SizeY,Points,R,G,B,A)
  35.     local Tex = getglobal(frame):CreateTexture("ARTWORK")    
  36.     Tex:SetTexture("Interface/Buttons/WHITE8x8")
  37.     Tex:SetSize(SizeX, SizeY)
  38.     if type(Points) == "table" then
  39.       for _,V in pairs(Points) do
  40.         if V.RelF then
  41.           Tex:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  42.         else
  43.           Tex:SetPoint(V.Point, V.X, V.Y)
  44.         end
  45.       end
  46.     end
  47.     Tex:SetColorTexture(R,G,B,A)
  48. end
  49. function Create_ChkButton(Frame,Name,SizeX,SizeY,Points,tooltip,Scripts)
  50.     ChkBtn = CreateFrame("CheckButton", Name, getglobal(Frame), "ChatConfigCheckButtonTemplate")
  51.     if type(Points) == "table" then
  52.       for _,V in pairs(Points) do
  53.         if V.RelF then
  54.           print(V.X, V.Y)
  55.           ChkBtn:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  56.         else
  57.           ChkBtn:SetPoint(V.Point, V.X, V.Y)
  58.         end
  59.       end
  60.     end
  61.     ChkBtn:SetSize(SizeX or 20,SizeY or 20)
  62.     if tooltip then ChkBtn.tooltip = tooltip end
  63.     if type(Scripts) == "table" then
  64.       for i=1, #Scripts do
  65.         ChkBtn:SetScript(Scripts[i].On,Scripts[i].Func)      
  66.       end
  67.     end
  68. end
  69. function Create_RadioButton(Frame,Name,SizeX,SizeY,Points,tooltip,Scripts)
  70.   RadioBtn = CreateFrame("CheckButton", Name, getglobal(Frame), "UIRadioButtonTemplate")
  71.   if type(Points) == "table" then
  72.     for _,V in pairs(Points) do
  73.       if V.RelF then
  74.         print(V.X, V.Y)
  75.         RadioBtn:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  76.       else
  77.         RadioBtn:SetPoint(V.Point, V.X, V.Y)
  78.       end
  79.     end
  80.   end
  81.   RadioBtn:SetSize(SizeX or 20,SizeY or 20)
  82.   if tooltip then RadioBtn.tooltip = tooltip end
  83.   if type(Scripts) == "table" then
  84.     for i=1, #Scripts do
  85.       RadioBtn:SetScript(Scripts[i].On,Scripts[i].Func)      
  86.     end
  87.   end
  88. end
  89. function Create_Button(Name,Parent,SizeX,SizeY,Points,Scripts,Textures,Text)
  90.   local btn = CreateFrame("Button", Name, Parent, "UIPanelButtonTemplate")
  91.   btn:SetSize(SizeX, SizeY)
  92.   if type(Points) == "table" then
  93.     for _,V in pairs(Points) do
  94.       if V.RelF then
  95.         btn:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  96.       else
  97.         btn:SetPoint(V.Point, V.X or 0, V.Y or 0)
  98.       end
  99.     end
  100.   end  
  101.   if type(Textures) == "table" then
  102.     if Textures.U then btn:SetNormalTexture(Textures.U)     end
  103.     if Textures.D then btn:SetPushedTexture(Textures.D)     end
  104.     if Textures.H then
  105.       btn:SetHighlightTexture(Textures.H)
  106.       btn:GetHighlightTexture():SetTexCoord(0,1,0,1)
  107.     end
  108.   end
  109.   if type(Scripts) == "table" then
  110.     for i=1, #Scripts do
  111.       btn:SetScript(Scripts[i].On,Scripts[i].Func)      
  112.     end
  113.   end
  114.   if Text then btn:SetText(Text) end
  115. end
  116. function Create_Tab(Name,Parent,ID,SizeX,SizeY,Points,Scripts,Textures,Text)
  117.   local tab = CreateFrame("Button", Name, Parent, "CharacterFrameTabButtonTemplate")
  118.   tab:SetID(ID)
  119.   if SizeX then tab:SetSize(SizeX, SizeY) end
  120.   if type(Points) == "table" then
  121.     for _,V in pairs(Points) do
  122.       if V.RelF then
  123.         tab:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  124.       else
  125.         tab:SetPoint(V.Point, V.X or 0, V.Y or 0)
  126.       end
  127.     end
  128.   end  
  129.   if type(Textures) == "table" then
  130.     if Textures.U then tab:SetNormalTexture(Textures.U)     end
  131.     if Textures.D then tab:SetPushedTexture(Textures.D)     end
  132.     if Textures.H then
  133.       tab:SetHighlightTexture(Textures.H)
  134.       tab:GetHighlightTexture():SetTexCoord(0,1,0,1)
  135.     end
  136.   end
  137.   if type(Scripts) == "table" then
  138.     for i=1, #Scripts do
  139.       tab:SetScript(Scripts[i].On,Scripts[i].Func)      
  140.     end
  141.   end
  142.   if Text then tab:SetText(Text) end
  143. end
  144. function Create_Dropdown(Name,Parent,SizeX,SizeY,Points,Scripts)
  145.   print(Parent:GetName())
  146.   local drop = CreateFrame("Frame", Name, EZTC_1, "UIDropDownMenuTemplate")
  147.   UIDropDownMenu_Initialize(drop, EZM_DropDownLoad)
  148.   if SizeX or SizeY then drop:SetSize(SizeX, SizeY) end
  149.   if type(Points) == "table" then
  150.     for _,V in pairs(Points) do
  151.       print(V.X,V.Y)
  152.       if V.RelF then
  153.         drop:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  154.       else
  155.         drop:SetPoint(V.Point, V.X or 0, V.Y or 0)
  156.       end
  157.     end
  158.   end  
  159.   if type(Scripts) == "table" then
  160.     for i=1, #Scripts do
  161.       drop:SetScript(Scripts[i].On,Scripts[i].Func)      
  162.     end
  163.   end
  164.  
  165. end
  166. function Create_EditBox(Name,Parent,SizeX,SizeY,Points,Scripts,Other)--{Autofocus,Multiline,FontObject,MaxChars,Numeric}
  167.   local Editbox = CreateFrame("EditBox", Name, Parent)
  168.   Editbox:SetSize(SizeX, SizeY)
  169.   if type(Points) == "table" then
  170.     for _,V in pairs(Points) do
  171.       if V.RelF then
  172.         Editbox:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  173.       else
  174.         Editbox:SetPoint(V.Point, V.X or 0, V.Y or 0)
  175.       end
  176.     end
  177.   end  
  178.   if type(Scripts) == "table" then
  179.     for i=1, #Scripts do
  180.       Editbox:SetScript(Scripts[i].On,Scripts[i].Func)      
  181.     end
  182.   end
  183.   if type(Other) == "table" then
  184.     Editbox:SetAutoFocus(Other.SetAutoFocus)
  185.     if Other.Multiline      then Editbox:SetMultiLine(true) end
  186.     if Other.FontObject     then Editbox:SetFontObject(Other.FontObject) end
  187.     if Other.MaxChars       then Editbox:SetMaxLetters(Other.MaxChars) end
  188.     if Other.Numeric        then Editbox:SetNumeric(true) end
  189.   end
  190. end
  191. function Create_Frame(Type,Name,Parent,Template,SizeX,SizeY,Points,Scripts,Other)--(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0){SetMovable,EnableMouse,TopLevel,Hidden}
  192.     if Template then
  193.       Frm = CreateFrame(Type, Name, Parent, Template)
  194.     else
  195.       Frm = CreateFrame(Type, Name, Parent)
  196.     end
  197.     if SizeX or SizeY then Frm:SetSize(SizeX,SizeY) end
  198.     if type(Points) == "table" then
  199.       for _,V in pairs(Points) do
  200.         if V.RelF then
  201.           Frm:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  202.       else
  203.           Frm:SetPoint(V.Point, V.X, V.Y)
  204.         end
  205.       end
  206.     end
  207.     if type(Scripts) == "table" then
  208.       for i=1, #Scripts do
  209.         print(Scripts[i].On,Scripts[i].Func)    
  210.       end
  211.     end
  212.     if type(Other) == "table" then
  213.       if Other.Strata then Frm:SetFrameStrata(Other.Strata) end
  214.       if Other.Scale then Frm:SetScale(Other.Scale) end
  215.       if Other.SetMovable then Frm:SetMovable(true) end
  216.       if Other.EnableMouse then Frm:EnableMouse(true) end
  217.       if Other.TopLevel then Frm:SetToplevel(true) end
  218.       if Other.Hidden then Frm:Hide() end
  219.     end
  220. end  
  221. function Create_Image(Frame,Name,Layer,File,SizeX,SizeY,Points,Coords,R,G,B,A)
  222.   local Img = getglobal(Frame):CreateTexture(Name,Layer)    
  223.     Img:SetTexture(File)
  224.     Img:SetSize(SizeX, SizeY)
  225.     if type(Points) == "table" then
  226.       for K,V in pairs(Points) do
  227.         print(K,V)
  228.         if V.RelF then
  229.           Img:SetPoint(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0);
  230.         else
  231.           Img:SetPoint(V.Point, V.X, V.Y)
  232.         end
  233.       end
  234.     end
  235.     if type(Coords) =="table" then
  236.       Img:SetTexCoord(Coords.L,Coords.R,Coords.T,Coords.B)
  237.     end
  238.     if R then Img:SetColorTexture(R,G,B) end
  239.     if A then Img:SetAlpha(A) end
  240. end
  241. -----------------------------------------------------
  242. --- OTHER BASE FUNCTIONS                          ---
  243. -----------------------------------------------------
  244. function ConvertHex(nValue)
  245.   nHexVal = string.format("%x", nValue)
  246.     sHexVal = nHexVal..""
  247.   return string.format("%02s", sHexVal)
  248. end
  249. function ConvertBool(bool)
  250.   if bool then
  251.     return "true"
  252.   else
  253.     return "false"
  254.   end
  255. end
  256. function Wrapper(str, limit, indent, indent1)
  257.   indent = indent or ""
  258.   indent1 = indent1 or indent
  259.   limit = limit or 12
  260.   local here = 1-#indent1
  261.   return indent1..str:gsub("(%s+)()(%S+)()",
  262.       function(sp, st, word, fi)
  263.           if fi-here > limit then
  264.               here = st - #indent
  265.               return "\n"..indent..word
  266.           end
  267.   end)
  268. end
  269. function GearDur()
  270.   local cur,max
  271.   local TotalCur, TotalMax = 0, 0
  272.   for slot=1,18 do
  273.     cur,max=GetInventoryItemDurability(slot)
  274.     if cur then
  275.         TotalCur = TotalCur + cur
  276.         TotalMax = TotalMax + max
  277.     end
  278.   end
  279.   return ((TotalCur / TotalMax)*100), TotalMax
  280. end
  281. -----------------------------------------------------
  282. --- EZ MOUNT FRAME MAKERS                         ---
  283. -----------------------------------------------------
  284. function Create_ConfigFrame()
  285.   -- Create base frame with headers
  286.   local panel = CreateFrame("FRAME","EZMF",nil,nil,nil,nil,nil)
  287.   panel.name = "EZ Mount Test"
  288.   InterfaceOptions_AddCategory(panel)
  289.   defFrame = "EZTC_2"
  290.   Create_Image("EZMF","BG","ARTWORK","Interface\\Buttons\\WHITE8x8",580,480,{{Point="TOP",X=0,Y=-22,RelF=false}},.2,.2,.2,.2,.7)
  291.   -- TAB Background & Tab Container
  292.   Create_Frame("Frame","EZTC",EZMF,nil,580,480,{{Point="TOP",X=0,Y=-20}})
  293.   Create_Frame("Frame","EZTC_1",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=false})
  294.   Create_Frame("Frame","EZTC_2",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true})
  295.   Create_Frame("Frame","EZTC_3",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true})
  296.   Create_Frame("Frame","EZTC_4",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true})
  297.   Create_Frame("Frame","EZTC_5",EZTC,nil,580,480,{{Point="TOPLEFT",RelF=EZTC},{Point="BOTTOMRIGHT",RelF=EZTC}},false,{Hidden=true})
  298.   Create_Frame("ScrollFrame","EZTC_5SFrame",EZTC_5,"UIPanelScrollFrameTemplate",nil,nil,{{Point="TOPLEFT",RelP="TOPLEFT",RelF="EZTC_5",X=5,Y=-35},{Point="BOTTOMLEFT",RelP="BOTTOMLEFT",RelF="EZTC_5",X=5,Y=5},{Point="RIGHT",RelP="RIGHT",RelF="EZTC_5",X=-28,Y=0}})
  299.   Create_Frame("Frame","EZTC_5SChild",nil,nil,570,440)
  300.   EZTC_5SFrame:SetScrollChild(EZTC_5SChild)
  301.   Create_Text("EZTC_1","T_Mounts",180,50,"MOUNTS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge")
  302.   Create_Text("EZTC_2","T_Options",180,50,"OPTIONS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge")
  303.   Create_Text("EZTC_3","T_UI Messages",180,50,"UI MESSAGES",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge")
  304.   Create_Text("EZTC_4","T_Class",180,50,"CLASS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge")
  305.   Create_Text("EZTC_5SChild","T_SelGround",180,50,"SELECT GROUND MOUNTS",{{Point="TOPLEFT",X=0,Y=0}},"LEFT",nil,{Type=1,R=.9215,G=.5607,B=.2039,A=.9},"GameFontNormalLarge")
  306.  
  307.   Create_Tab("EZTCTab1",EZTC,1,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTC,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_1,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Mounts")
  308.   Create_Tab("EZTCTab2",EZTC,2,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab1,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_2,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Options")
  309.   Create_Tab("EZTCTab3",EZTC,3,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab2,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_3,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"UI Message")
  310.   Create_Tab("EZTCTab4",EZTC,4,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab3,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_4,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Class")
  311.   Create_Tab("EZTCTab5",EZTC,5,60,30,{{Point="TOPLEFT",X=-19,Y=0,RelF=EZTCTab4,RelP="BOTTOMLEFT"}},{{On="OnClick", Func=function() EZT_ChangeTab(EZTC_5,{EZTC_1, EZTC_2, EZTC_3, EZTC_4, EZTC_5}) end;}},nil,"Select:Ground")
  312.  
  313.   PanelTemplates_SetNumTabs(EZTC, 5)
  314.   PanelTemplates_SetTab(EZTC, 2)
  315. end
  316.  
  317. function Create_CountsFrame(Table)
  318.   local CMJ = C_MountJournal
  319.   local EID = CMJ.GetAppliedMountEquipmentID()
  320.   local Mount_IDs = { -- MOUNT EQUIPTMENT ID'S
  321.   [168412] = "Light-Step Hoofplates",     [168416] = "Anglers' Water Striders",
  322.     [168417] = "Inflatable Mount Shoes",    [168419] = "Comfortable Rider's Barding",
  323.     [168427] = "Saddlechute", }
  324.   local Txts = {"Ground Mount","Flying Mount","Sea Mount","Maw Mount","Class Mount","Vash'jir Mount","Heirloom Mount","Covenant Specific Mount","Passenger Ground Mount","Passenger Flying Mount"}
  325.   if EZTCount then
  326.     EZTCount:Show()
  327.   else
  328.     --- Create Frame and Title
  329.     Create_Frame("Frame","EZTCount",UIPARENT,"InsetFrameTemplate",300,235,{{Point="CENTER",X=0,Y=100}},"DIALOG",nil)
  330.     Create_Text("EZTCount",nil,200,20,EZMTitle,{{Point="TOP",X=0,Y=-8}},"CENTER","CENTER",{Type=1,R=.9,G=.87,B=.80},"IndexFont10")
  331.     --- Build the Data
  332.     BaseH = -15
  333.     StepH = 14
  334.     for i = 1, 10 do
  335.       Texts = Txts[i]
  336.       --- Process Druid Class Mount info here ( as druids dont have an actual mount just a new flight form )
  337.       if i == 5 and select(3,UnitClass("player")) == 11 then
  338.         if C_QuestLog.IsQuestFlaggedCompleted(46319) == true then
  339.           Counts = 1
  340.         else
  341.           Counts = 0
  342.         end
  343.       else
  344.         Counts = Table[i]
  345.       end
  346.  
  347.       --Counts = Table[i]
  348.       --- Add 's
  349.       if tonumber(Counts) == nil then Counts = 1 end
  350.       if Counts > 1 then
  351.         Text = "|c001d5add"..Texts.."s:"
  352.         Count = "|c000be6e2Yes ("..Counts..")"
  353.       elseif Counts == 1 then
  354.         Text = "|c001d5add"..Texts..":"
  355.         Count = "|c000be6e2Yes"
  356.       else
  357.         Text = "|c001d5add"..Texts..":"
  358.         Count ="|c000be6e2No"
  359.       end
  360.       Y = BaseH-(i * StepH)
  361.       Create_Text("EZTCount",nil,200, 20,Text, {{Point="TOPLEFT",X=30,Y=Y}}  , "LEFT","CENTER" ,{Type=1,R=.9,G=.8,B=.8},"Voltage_15")
  362.       Create_Text("EZTCount",nil,200, 20,Count,{{Point="TOPRIGHT",X=-30,Y=Y}}, "RIGHT","CENTER",{Type=1,R=.9,G=.8,B=.8},"Voltage_15")
  363.     end
  364.     --- Add Mount Equipment text
  365.     if CMJ.IsMountEquipmentApplied() and EID then
  366.       Mnt_Value = "|c000be6e2"..Mount_IDs[EID]
  367.     else
  368.       Mnt_Value = "|c000be6e2None"
  369.     end
  370.     Mnt_Txt = "|c001d5addMount Equipment:"
  371.     Create_Text("EZTCount",nil,200, 20,Mnt_Txt,  {{Point="TOPLEFT",X=30,Y=BaseH-(11*StepH)}}  , "LEFT","CENTER" ,nil,"Voltage_15")
  372.     Create_Text("EZTCount",nil,200, 20,Mnt_Value,{{Point="TOPRIGHT",X=-30,Y=BaseH-(11*StepH)}}, "RIGHT","CENTER",{Type=1,R=.9,G=.8,B=.8},"Voltage_15")
  373.     --- Add Total and class coloured name
  374.     Hex = "|c"..select(4,GetClassColor(select(2, UnitClass("player"))))
  375.     TotalTxt = "|cff48687aTotal Mounts for: "..Hex..UnitName("PLAYER")
  376.     Create_Text("EZTCount",nil,nil,nil,TotalTxt   ,{{Point="TOP",X=0,Y=-190}},"CENTER",nil,nil,"Nineteenth_17")
  377.     Create_Text("EZTCount",nil,nil,nil,Table[11]  ,{{Point="TOP",X=0,Y=-210}},"CENTER",nil,{Type=255,R=245,G=244,B=230},"IndexFont10")
  378.     --- Create Close Button
  379.    
  380.     Funct = function() if EZTCount then EZTCount:Hide() end end;
  381.     Create_Button("CloseCounts",EZTCount,20,20,{{Point = "BOTTOMRIGHT", X = -4, Y= 3}} ,{{On="OnClick",Func= Funct}},{U="Interface\\AddOns\\EZMount\\Images\\Close_U",D="Interface\\AddOns\\EZMount\\Images\\Close_D",H="Interface\\AddOns\\EZMount\\Images\\Close_H"})
  382.  
  383.     --- Show the frame    
  384.     EZTCount:Show()
  385.   end
  386. end
  387. function Create_Warning(Message)
  388.   if EZMWarning then
  389.     EZMWarning:Show()
  390.   else
  391.     Create_Frame("Frame", "EZMWarning", UIPARENT, "InsetFrameTemplate",200,75,{{Point = "CENTER", X = 0, Y=75}} ,"Tooltip")
  392.     Create_Text("EZMWarning",nil,190,75,Message,{{Point="CENTER",X=0,Y=0}},"CENTER","CENTER",{Type=255,R=237,G=12,B=177},"Nineteenth_17")
  393.     --- Create Button
  394.     Funct = function() if EZMWarning then EZMWarning:Hide() end end;
  395.     Create_Button("CloseWarning",EZMWarning,15,15,{{Point = "TOPRIGHT", X = -2, Y= -2}} ,{{On="OnClick",Func= Funct}},{U="Interface\\AddOns\\EZMount\\Images\\Close_U",D="Interface\\AddOns\\EZMount\\Images\\Close_D",H="Interface\\AddOns\\EZMount\\Images\\Close_H"})
  396.     EZMWarning:Show()
  397.   end
  398. end
  399. function Create_News()
  400. News = {  {Date ="6/22/21", Type = "Release", Version = "2.3.0", Added={"LATEST as new mount option. ( Only works when the addon is loaded and you have added a new mount since this version"},Fixed={"Druid class mount wasnt including in counts"}},
  401.           {Date ="4/18/21", Type = "Release", Version = "2.2.1", Fixed={"Options were resettings on login.","Mount off messages showing when icon was updating","Minimap hide/show not working correctly"}},
  402.           {Date ="4/15/21", Type = "Release", Version = "2.2.0", Added={"Minimap button. Shows mount types, can quick access repair mount or mount counts/option","News feed. Showing latest updates and bug fixes", "Selections. Select mounts for each type and pick randomly from this selection","Mount Options. Each mount type is now selected from the options panel"}, Fixed={"Mighty Brutosaur Caravan missing from passenger mount"},Beta={"Icons. Icons designed to work when using multiple macros","Debug. Debug info shown on screen and in chat box when using /ezm Debug"}},
  403.           {Date="22/03/21",Type = "Release", Version = "2.1.0", Added={"Interface panel with new options","Boot vendors from mounts in instances ( for DH skip near 3rd boss in Spires of Acension for example )","Double key shortcut + EZ Mount key to use herbalism mount","Druid affinity modifier key + EZ Mount key to change to your chose affinity in combat, click EZ Mount again to change back","Mountoff as a new selection for each modifier. When used, this will put you on the same mount as your target","The ability to enable/disable each of the EZ Mount messages and change the colour and the message","Added new Maw Mount: Bound Shadehound"},Fixed={"Torghast mounts now working correctly for Shaman","Icon code updated"}},
  404.           {Date="17/02/21",Type = "Release", Version = "2.0.0", Added={"Options panel. Accessible from options>Interface>addons or from slash commands","Slash commands /EZMount or /EZM followed with config or options for panel and mounts or count for total mounts usable","New mount types: Covenant and Favorite ( mounts favourited in the Blizzard UI )"},Fixed={"Class now working correctly for Druids as druids have a skin as their class mount"}},
  405.           {Date="25/01/21",Type = "Release", Version = "1.2.3", Fixed={"Maw mounts should now work correctly"}},
  406.           {Date="11/01/21",Type = "Release", Version = "1.2.2", Added={"Added Maw Mounts","Added Covenant specific mounts"},Fixed={"Removed debug message for can_glide"}},
  407.           {Date="24/12/20",Type = "Release", Version = "1.2.1", Fixed={"Fixed error when checking for heirloom collector achievement mount","Addon was checking for any spell usable from your cloak rather than just the engineering glider enchants"}},
  408.           {Date="25/11/20",Type = "Release", Version = "1.2.0", Added={"Added Shadowlands zones","Added Maw mount"},Fixed={"Passenger mount not working","Fixed 1 profession mount that no longer requires profession"}},
  409.           {Date="12/11/20",Type = "Release", Version = "1.1.0", Fixed={"Pathfinder no longer required for Broken Isles and Draenor","Class specific mounts were showing for all class's"}},
  410.           {Date="10/11/20",Type = "Release", Version = "1.0.1", Added={"Added support for heirloom mounts","Added Ocean mounts ( after ground and flying )","Mount counter for mounts usable on current character"},Fixed={"Fixed profession mounts","Zones not working correctly i.e Black Empire Assaults","Case sensitivity removed from mounts"}},
  411.           {Date="10/10/20",Type = "Release", Version = "1.0.0"},
  412.         }
  413.  
  414.   if EZMNews then
  415.     EZMNews:Show()
  416.   else
  417.     Create_Frame("Frame", "EZMNews", UIPARENT, "InsetFrameTemplate",350,250,{{Point="CENTER",X=0,Y=75}},"DIALOG",nil)--(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0)
  418.     Create_Frame("ScrollFrame","EZMNewsSParent",EZMNews,"UIPanelScrollFrameTemplate",340,225,{{Point="TOPLEFT",RelF=EZMNews,RelP="TOPLEFT",X=1,Y=-35},{Point="BOTTOMLEFT",RelF=EZMNews,RelP="BOTTOMLEFT",X=1,Y=2},{Point="RIGHT",RelF=EZMNews,RelP="RIGHT",X=-27,Y=-20},}, nil,.75)
  419.     Create_Frame("Frame","EZMNewsChild", nil, nil,340,225,{{Point="TOPLEFT", RelF=EZMNewsSParent,RelP="TOPLEFT",X=25,Y=15},{Point="BOTTOMLEFT", RelF=EZMNewsSParent,RelP="BOTTOMLEFT",X=-5,Y=-5}},nil,1)--(V.Point, V.RelF, V.RelP, V.X or 0 , V.Y or 0)
  420.     EZMNewsSParent:SetScrollChild(EZMNewsChild)
  421.     -- Create Close Button
  422.     Funct = function() EZMVer = Version if EZMNews then EZMNews:Hide() end end;
  423.     Create_Button("CloseCounts",EZMNewsSParent,25,25,{{Point = "TOPRIGHT", X = 23, Y= 29}} ,{{On="OnClick",Func= Funct}},{U="Interface\\AddOns\\EZMount\\Images\\Close_U",D="Interface\\AddOns\\EZMount\\Images\\Close_D",H="Interface\\AddOns\\EZMount\\Images\\Close_H"})
  424.     -- Show Title
  425.     TitleText = EZMTitle.." |cFF0cd6edN|cFF0cadedE|cFF0c88edW|cFF0c6aedS"
  426.     Create_Text("EZMNews",nil,180,30,TitleText,{{Point="TOP",X=0,Y=-2}},"CENTER","CENTER",nil,"ThinFont17")
  427.     Y = -3
  428.     for V = 1,#News do
  429.       Date = News[V].Date
  430.       Type = News[V].Type
  431.       Ver = News[V].Version
  432.       Create_Text("EZMNewsChild",nil,80,20,Date,{{Point="TOPLEFT",X=5,Y=Y}},"LEFT",nil,{Type=255,R=88,G=191,B=191,A=255},"ThinFont13")
  433.       Create_Text("EZMNewsChild",nil,80,20,"Ver. "..Ver,{{Point="TOPLEFT",X=65,Y=Y}},"LEFT",nil,{Type=255,R=41,G=148,B=194},"ThinFont13")
  434.       Create_Text("EZMNewsChild",nil,90,20,"( "..Type.." )",{{Point="TOPLEFT",X=145,Y=Y}},"LEFT",nil,{Type=255,R=41,G=115,B=194},"ThinFont13")
  435.       Y = ( Y - 15 )
  436.       Added = News[V].Added
  437.       if Added then
  438.         if #News[V].Added > 0 then
  439.           for _,Text in pairs(Added) do
  440.             Create_Text("EZMNewsChild",nil,80,30,"Added :",{{Point="TOPLEFT",X=5,Y=Y}},"LEFT","CENTER",{Type=255,R=63,G=242,B=111},"ThinFont11")
  441.             Create_Text("EZMNewsChild",nil,380,30,Text,{{Point="TOPLEFT",X=55,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=229,B=202},"ThinFont11")
  442.             Y = (Y - 23)
  443.           end
  444.         end
  445.       end
  446.       Fixed = News[V].Fixed
  447.       if Fixed then
  448.         if #News[V].Fixed > 0 then
  449.           for _,Text in pairs(Fixed) do
  450.             Create_Text("EZMNewsChild",nil,80,30,"Fixed :",{{Point="TOPLEFT",X=5,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=217,B=37},"ThinFont11")
  451.             Create_Text("EZMNewsChild",nil,380,30,Text,{{Point="TOPLEFT",X=55,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=229,B=202},"ThinFont11")
  452.             Y = Y -23
  453.           end
  454.         end
  455.       end
  456.       Beta = News[V].Beta
  457.       if Beta then
  458.         if #News[V].Beta > 0 then
  459.           for _,Text in pairs(Beta) do
  460.             Create_Text("EZMNewsChild",nil,80,30,"Beta :",{{Point="TOPLEFT",X=5,Y=Y}},"LEFT","CENTER",{Type=255,R=224,G=13,B=56},"ThinFont11")
  461.             Create_Text("EZMNewsChild",nil,380,30,Text,{{Point="TOPLEFT",X=55,Y=Y}},"LEFT","CENTER",{Type=255,R=230,G=229,B=202},"ThinFont11")
  462.             Y = Y -23
  463.           end
  464.         end
  465.       end
  466.       Y = Y - 16
  467.     end
  468.   end
  469. end
  470. function Create_SelectionTable(TblName,TabNo)
  471.   -- Clear Table
  472.   for List = 1, #TblName do
  473.     if #TblName[list] >=1 then
  474.       for v = 1, #TblName[list] do
  475.         TblName[list] = nil
  476.       end
  477.     end
  478.   end
  479.   -- Put checked items into table
  480.   local ObjNames = { getglobal("Tab_"..TabNo.."SArea"):GetChildren() }
  481.   for _,framechild in ipairs(ObjNames) do
  482.     Mname = gsub(framechild:GetName(),"Tab_"..TabNo,"")
  483.     Ischecked = framechild:GetChecked()
  484.     if Mname and Ischecked then
  485.       table.insert(TblName,Mname)
  486.     end
  487.   end
  488. end
  489. function Recreate_SelectionTable(TblName,TabNo)
  490.   -- Clear checks first
  491.     local ObjNames = { getglobal("Tab_"..TabNo.."SArea"):GetChildren() }
  492.     for _,framechild in ipairs(ObjNames) do
  493.       framechild:SetChecked(false)
  494.     end
  495.     for k,v in pairs(TblName) do
  496.       if type(getglobal("Tab_"..TabNo..v)) == "table" then
  497.         getglobal("Tab_"..TabNo..v):SetChecked(true)
  498.       end
  499.     end
  500. end
  501. function Create_SelectionTab(Header, TabNo, TableList)
  502.   local Y = 10
  503.   local X = nil              
  504.   local Col = 0.010           --Color gradiant starting colour
  505.   local CurLetter = nil       --Current Letter
  506.   local ActLetter = nil       --Letter vs Current
  507.   local Indent = nil          --Spacing
  508.   local MntTbl = {}
  509.   -- Build Table to use and then sort it
  510.   for i=1,#TableList do
  511.     for k,v in pairs(TableList[i]) do
  512.       table.insert(MntTbl,v)
  513.     end
  514.   end
  515.   table.sort(MntTbl) -- Alphabetise mount list
  516.   -- Set Header
  517.   if type(getglobal(TabNo)) ~= "table" then
  518.     Create_Text(TabNo.."SFrame",TabNo,370,20,Header.." ( "..#MntTbl.." )",{{Point="TOPLEFT",X=0,Y=30}},"LEFT","CENTER",{Type=1,R=.9,G=.87,B=.80},"Nineteenth_19")
  519.     -- Build buttons and labels with dividers and side index
  520.     for k,v in ipairs(MntTbl) do
  521.       if not CurLetter then
  522.         CurLetter = string.sub(v, 1, 1)
  523.         Create_Text(TabNo.."SArea",nil,20,20,CurLetter,{{Point="TOPLEFT",X=2,Y=-(Y+2)}},"CENTER","CENTER",{Type=1,R=Col/3,G=Col/2,B=.80},"IndexFont10")
  524.       end
  525.       ActLetter = string.sub(v, 1, 1)
  526.       if ActLetter == CurLetter then
  527.         if not Indent then Indent = 1 end
  528.         X = 45 + ((Indent-1) * 175)
  529.         Create_Text(TabNo.."SArea",nil,150,28,v,{{Point="TOPLEFT",X=X,Y=-Y}},"LEFT","CENTER",{Type=1,R=.81,G=.85,B=.82},"ThinFont11")
  530.         Create_ChkButton(TabNo.."SArea",TabNo..v,28,28,{{Point="TOPLEFT",X = (X-25),Y =(-Y)}},"")
  531.         Indent = Indent + 1   --Increase Column
  532.         if Indent == 4 then   --Reset Column, Increase Row
  533.           Indent = 1
  534.           Y = Y + 30
  535.         end    
  536.       else
  537.         if Indent ~= 1 then   --If we are at a new line, dont add Padding, and reset Column
  538.           Y=Y+30
  539.           Indent = 1
  540.         end
  541.         X = 45 + ((Indent-1) * 175)
  542.         Col = Col + 0.045
  543.         CurLetter = string.sub(v, 1, 1)
  544.         Create_Line(TabNo.."SArea",540,1,{{Point="TOPLEFT",X= 6, Y=-(Y-3)}},.9215,0.8607,.8039,.7)
  545.         Create_Text(TabNo.."SArea",nil,20,20,CurLetter,{{Point="TOPLEFT",X=2,Y=-(Y+2)}},"CENTER","CENTER",{Type=1,R=Col/3,G=Col/2,B=.80},"IndexFont10")
  546.         Create_Text(TabNo.."SArea",nil,150,28,v,{{Point="TOPLEFT",X=X,Y=-Y}},"LEFT","CENTER",{Type=1,R=.81,G=.85,B=.82},"ThinFont11")      
  547.         Create_ChkButton(TabNo.."SArea",TabNo..v,28,28,{{Point="TOPLEFT",X = (X-25),Y =(-Y)}},"")
  548.         Indent = Indent + 1
  549.       end
  550.     end
  551.   end
  552. end
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Tab Issues

Thread Tools
Display Modes

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