View Single Post
02-12-16, 01:56 PM   #6
tyroneexe
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Feb 2016
Posts: 13
I moved the frame to the top and renamed it (i hope it's the right spot) - This now shows the frame, unmovable, but not the buttons.

Am I missing something after frame:StopMovingOrSizing() ? func?


Lua Code:
  1. local frame = CreateFrame("Frame","AshranCommander",UIParent)
  2. frame:SetWidth(40+40+20)
  3. frame:SetHeight((7*40)+20)
  4. frame:ClearAllPoints()
  5. frame:SetBackdrop(StaticPopup1:GetBackdrop())
  6. frame:SetPoint("CENTER",UIParent)
  7. frame:SetScale(scale)
  8. frame:Show()
  9. frame:SetMovable(movable)
  10. frame:StartMoving()
  11. frame:StopMovingOrSizing()
  12.  
  13.  
  14.  
  15. local CreateButton; do-- Prototype for function
  16. --  Tooltip Handlers
  17.     local function OnEnter(self)
  18.         if self.Tooltip then
  19.             GameTooltip:SetOwner(self,"ANCHOR_TOP");
  20.             GameTooltip:AddLine(self.Tooltip,0,1,0.5,1,1,1);
  21.             GameTooltip:Show();
  22.         end
  23.     end
  24.     local function OnLeave(self) if GameTooltip:IsOwned(self) then GameTooltip:Hide(); end end
  25.  
  26. --  Button Generator (this will be assigned to the upvalue noted as a function prototype)
  27.     function CreateButton(parent,name,texture,text,tooltip)
  28.         tooltip=tooltip or text;--  If no tooltip, use button text
  29.  
  30. --      Create our button
  31.         local btn=CreateFrame("Button",name,parent,"SecureActionButtonTemplate");
  32.         btn:RegisterForClicks("AnyUp");--   Register all buttons
  33.         btn:SetSize(30,30);
  34.  
  35. --      Setup button text
  36.         btn:SetNormalFontObject("GameFontNormalSmall");
  37.         btn:SetHighlightFontObject("GameFontHighlightSmall");
  38.         btn:SetDisabledFontObject("GameFontDisableSmall");
  39.         btn:SetText(text);
  40.  
  41. --      Setup button's backgorund, you can use :SetNormalTexture() and other functions to set state-based textures
  42.         local tex=btn:CreateTexture(nil,"BACKGROUND");
  43.         tex:SetAllPoints(btn);
  44.         tex:SetTexture(texture);
  45.         btn.Texture=tex;
  46.  
  47. --      Register handlers
  48.         btn:SetScript("OnEnter",OnEnter);
  49.         btn:SetScript("OnLeave",OnLeave);
  50.         btn.Tooltip=tooltip;
  51.  
  52. --      Return our button
  53.         return btn;
  54.     end
  55. end
  56.  
  57. local button=CreateButton(AshranCommander,"AshranCommanderButton1","Interface\\Icons\\achievement_pvp_a_h",nil,"Warspear Keep");
  58. button:SetPoint("TOPRIGHT",AshranCommander,"CENTER",13,-13);-- Anchors always default to an object's parent
  59. button:SetScript("OnClick", function()
  60.          SendChatMessage("Warspear Keep ","SAY")
  61.          DoEmote("follow")
  62.     end )
  63. local button=CreateButton(AshranCommander,"AshranCommanderButton2","Interface\\Icons\\achievement_garrison_tier02_horde",nil,"Emberfall Tower");
  64. button:SetPoint("TOP",AshranCommanderButton1,"BOTTOM",0,-1);-- Anchors always default to an object's parent
  65. button:SetScript("OnClick", function()
  66.          SendChatMessage("Emberfall Tower ","SAY")
  67.          DoEmote("follow" , UnitName("target"))
  68.     end )
  69. local button=CreateButton(AshranCommander,"AshranCommanderButton3","Interface\\Icons\\achievement_garrison_tier01_horde",nil,"Volrath's Advance");
  70. button:SetPoint("TOP",AshranCommanderButton2,"BOTTOM",0,-1);-- Anchors always default to an object's parent
  71. button:SetScript("OnClick", function()
  72.          SendChatMessage("Volrath's Advance ","SAY")
  73.          DoEmote("follow" , UnitName("target"))
  74.     end )
  75. local button=CreateButton(AshranCommander,"AshranCommanderButton4","Interface\\Icons\\achievement_doublejeopardy",nil,"The Crossroads");
  76. button:SetPoint("TOP",AshranCommanderButton3,"BOTTOM",0,-1);-- Anchors always default to an object's parent
  77. button:SetScript("OnClick", function()
  78.          SendChatMessage("The Crossroads ","SAY")
  79.          DoEmote("follow" , UnitName("target"))
  80.     end )
  81. local button=CreateButton(AshranCommander,"AshranCommanderButton5","Interface\\Icons\\achievement_garrison_tier01_alliance",nil,"Tremblade's Vanguard");
  82. button:SetPoint("TOP",AshranCommanderButton4,"BOTTOM",0,-1);-- Anchors always default to an object's parent
  83. button:SetScript("OnClick", function()
  84.          SendChatMessage("Tremblade's Vanguard ","SAY")
  85.          DoEmote("follow" , UnitName("target"))
  86.     end )
  87. local button=CreateButton(AshranCommander,"AshranCommanderButton6","Interface\\Icons\\achievement_garrison_tier02_alliance",nil,"Archmage Overwatch");
  88. button:SetPoint("TOP",AshranCommanderButton5,"BOTTOM",0,-1);-- Anchors always default to an object's parent
  89. button:SetScript("OnClick", function()
  90.          SendChatMessage("Archmage Overwatch ","SAY")
  91.          DoEmote("follow" , UnitName("target"))
  92.     end )
  93. local button=CreateButton(AshranCommander,"AshranCommanderButton7","Interface\\Icons\\achievement_pvp_h_a",nil,"Stormshield Stronghold");
  94. button:SetPoint("TOP",AshranCommanderButton6,"BOTTOM",0,-1);-- Anchors always default to an object's parent
  95. button:SetScript("OnClick", function()
  96.          SendChatMessage("Stormshield Stronghold ","SAY")
  97.          DoEmote("follow" , UnitName("target"))
  98.     end )
  99. local button=CreateButton(AshranCommander,"AshranCommanderButton8","Interface\\Icons\\Ability_rogue_sprint",nil,"Amphitheater of Annihilation(AoA)");
  100. button:SetPoint("RIGHT",AshranCommanderButton1,"LEFT",0,0);-- Anchors always default to an object's parent
  101. button:SetScript("OnClick", function()
  102.          SendChatMessage("AoA - EVENT:STADIUM RACING - Block the entrance!","SAY")
  103.          DoEmote("follow" , UnitName("target"))
  104.     end )
  105. local button=CreateButton(AshranCommander,"AshranCommanderButton9","Interface\\Icons\\spell_fire_fire",nil,"Brute's Rise(BR)");
  106. button:SetPoint("RIGHT",AshranCommanderButton2,"LEFT",0,0);-- Anchors always default to an object's parent
  107. button:SetScript("OnClick", function()
  108.          SendChatMessage("BR - EVENT:OGRE FIRES - Block the stairs! ","SAY")
  109.          DoEmote("follow" , UnitName("target"))
  110.     end )
  111. local button=CreateButton(AshranCommander,"AshranCommanderButton10","Interface\\Icons\\achievement_boss_furyfurnace",nil,"Ring of Conquest(RoC)");
  112. button:SetPoint("RIGHT",AshranCommanderButton3,"LEFT",0,0);-- Anchors always default to an object's parent
  113. button:SetScript("OnClick", function()
  114.          SendChatMessage("Ring of Conquest GO RoC ","SAY")
  115.          DoEmote("follow" , UnitName("target"))
  116.     end )
  117. local button=CreateButton(AshranCommander,"AshranCommanderButton11","Interface\\Icons\\Trade_archaeology_apexisstatue",nil,"Ashran Excavation(Mines)");
  118. button:SetPoint("RIGHT",AshranCommanderButton4,"LEFT",0,0);-- Anchors always default to an object's parent
  119. button:SetScript("OnClick", function()
  120.          SendChatMessage("Ashran Excavation - EVENT:APEXIS MARKS - Secure the center!  ","SAY")
  121.          DoEmote("follow" , UnitName("target"))
  122.     end )
  123. local button=CreateButton(AshranCommander,"AshranCommanderButton12","Interface\\Icons\\achievement_reputation_ogre",nil,"Seat of Kor'lok");
  124. button:SetPoint("RIGHT",AshranCommanderButton5,"LEFT",0,0);-- Anchors always default to an object's parent
  125. button:SetScript("OnClick", function()
  126.          SendChatMessage("Seat of Kor'lok - Kor'lok - Kill the ogre!  ","SAY")
  127.          DoEmote("follow" , UnitName("target"))
  128.     end )
  129. local button=CreateButton(AshranCommander,"AshranCommanderButton13","Interface\\Icons\\Spell_lifegivingspeed",nil,"Molten Quarry(MQ)");
  130. button:SetPoint("RIGHT",AshranCommanderButton6,"LEFT",0,0);-- Anchors always default to an object's parent
  131. button:SetScript("OnClick", function()
  132.          SendChatMessage("Molten Quarry - EVENT:Empowered Ore - Block the entrance!  ","SAY")
  133.          DoEmote("follow" , UnitName("target"))
  134.     end )
  135. local button=CreateButton(AshranCommander,"AshranCommanderButton14","Interface\\Icons\\Achievement_halloween_ghost_01",nil,"Ashmaul Burial Grounds(ABG)");
  136. button:SetPoint("RIGHT",AshranCommanderButton7,"LEFT",0,0);-- Anchors always default to an object's parent
  137. button:SetScript("OnClick", function()
  138.          SendChatMessage("Ashmaul Burial Grounds - EVENT:RISEN SPIRITS - Clear the center and block the entrance!  ","SAY")
  139.          DoEmote("follow" , UnitName("target"))
  140.     end )
  Reply With Quote