View Single Post
11-26-13, 04:55 AM   #25
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
Originally Posted by Phanx View Post
Sorry, you're going to have to be more clear about what you want, and/or post more of your code. Based on the snippets you posted, it appears you want to insert a bunch of option widgets into a button, which doesn't make any sense. Presumably there is some other frame that contains the button, and you want to show the other stuff when you click the button, but without seeing the code, that's about all I can come up with.
ok im going to try here to explain what it is i am trying to do

the button named Options Frame i want as a button that fires a function OnClick as seen here
on line 7, the referance to TopFrame is an already existing frame within my artwork.lua. the button places properly, but does not fire.
Lua Code:
  1. local frame = CreateFrame("Button", "OptionsFrame", TopFrame, "UIPanelButtonTemplate")
  2. frame:SetHeight(21)
  3. frame:SetWidth(80)
  4. frame:SetText("Options")
  5. frame:ClearAllPoints()
  6. frame:SetPoint("CENTER", 0, 0)
  7. OptionsFrame:SetScript("OnClick", OptionFrame)

the code i want it to fire is the options config window i am designing
which is this. (these two blocks are the entirety of my code at this moment for this file)

Lua Code:
  1. function OptionFrame()
  2. --  Creating Background Frame Named Config_BaseFrame --------------
  3.     CreateFrame("frame", "Config_BaseFrame", UIParent)
  4.             Config_BaseFrame:SetWidth(1024)
  5.             Config_BaseFrame:SetHeight(512)
  6.             Config_BaseFrame:SetPoint("CENTER", UIParent,"CENTER")
  7.             Config_BaseFrame:SetFrameStrata("HIGH")
  8. --  MAKE THE FRAME MOVEABLE ON LEFT CLICK
  9.             Config_BaseFrame:SetMovable(true)
  10.             Config_BaseFrame:EnableMouse(true)
  11.             Config_BaseFrame:SetScript("OnMouseDown", function(self, button)
  12.     if button == "RightButton"
  13.     and not self.isMoving
  14.         then
  15.             self:StartMoving();
  16.             self.isMoving = true;
  17.         end
  18.     end);
  19.     Config_BaseFrame:SetScript("OnMouseUp", function(self, button)
  20.         if button == "RightButton"
  21.         and self.isMoving
  22.         then
  23.             self:StopMovingOrSizing();
  24.             self.isMoving = false;
  25.         end
  26.     end);
  27.     Config_BaseFrame:SetScript("OnHide", function(self)
  28.         if ( self.isMoving )
  29.         then
  30.             self:StopMovingOrSizing();
  31.             self.isMoving = false;
  32.         end
  33.     end)
  34.  
  35. --  END MAKE FRAMES MOVEABLE
  36. -- Close button
  37. local frame = CreateFrame("Button", "ExitSetup", Config_BaseFrame, "UIPanelCloseButton")
  38. frame:ClearAllPoints()
  39. frame:SetPoint("TOPRIGHT", -74, -8)
  40.  
  41.  
  42. --Save and Reload button
  43.  local frame = CreateFrame("Button", "SaveAndReload", Config_BaseFrame, "UIPanelButtonTemplate")
  44.  frame:SetHeight(20)
  45.  frame:SetWidth(100)
  46.  frame:SetText("Reload UI")
  47.  frame:ClearAllPoints()
  48.  frame:SetPoint("CENTER", 380, -165)
  49.  SaveAndReload:SetScript("OnClick", ReloadUI)
  50.  
  51.  
  52.  local frame = CreateFrame("Button", "AlignGrid", Config_BaseFrame, "UIPanelButtonTemplate")
  53.  frame:SetHeight(20)
  54.  frame:SetWidth(100)
  55.  frame:SetText("Alignment")
  56.  frame:ClearAllPoints()
  57.  frame:SetPoint("CENTER", -380, -165)
  58.  
  59. --  Setting The Background Image For Config_BaseFrame for left side
  60.     Config_BaseFrame.portrait = Config_BaseFrame:CreateTexture("Config_BaseFrame_Portrait", "BACKGROUND")
  61.     Config_BaseFrame.portrait:SetWidth(512)
  62.     Config_BaseFrame.portrait:SetHeight(512)
  63.     Config_BaseFrame.portrait:SetPoint("TOPLEFT", 0, 0)
  64.     Config_BaseFrame.portrait:SetTexture("Interface\\Addons\\Deranjata\\Media\\UI-GuildBankFrame-Left.tga")
  65.         --Button1
  66.         local frame = CreateFrame("Button", "Options1", Config_BaseFrame, "UIPanelButtonTemplate")
  67.         frame:SetHeight(36)
  68.         frame:SetWidth(67)
  69.         frame:SetText("Opt1")
  70.         frame:ClearAllPoints()
  71.         frame:SetPoint("CENTER", -451, 160)
  72.         Options1:SetScript("OnClick", ReloadUI)
  73.                         --Button7
  74.             local frame = CreateFrame("Button", "Options7", Config_BaseFrame, "UIPanelButtonTemplate")
  75.             frame:SetHeight(36)
  76.             frame:SetWidth(67)
  77.             frame:SetText("Opt7")
  78.             frame:ClearAllPoints()
  79.             frame:SetPoint("CENTER", 451, 160)
  80.             Options7:SetScript("OnClick", ReloadUI)
  81.         --Button2
  82.         local frame = CreateFrame("Button", "Options2", Config_BaseFrame, "UIPanelButtonTemplate")
  83.         frame:SetHeight(36)
  84.         frame:SetWidth(67)
  85.         frame:SetText("Opt2")
  86.         frame:ClearAllPoints()
  87.         frame:SetPoint("CENTER", -451, 110)
  88.         Options2:SetScript("OnClick", ReloadUI)
  89.                         --Button8
  90.             local frame = CreateFrame("Button", "Options8", Config_BaseFrame, "UIPanelButtonTemplate")
  91.             frame:SetHeight(36)
  92.             frame:SetWidth(67)
  93.             frame:SetText("Opt8")
  94.             frame:ClearAllPoints()
  95.             frame:SetPoint("CENTER", 451, 110)
  96.             Options8:SetScript("OnClick", ReloadUI)
  97.         --Button3
  98.         local frame = CreateFrame("Button", "Options3", Config_BaseFrame, "UIPanelButtonTemplate")
  99.         frame:SetHeight(36)
  100.         frame:SetWidth(67)
  101.         frame:SetText("Opt3")
  102.         frame:ClearAllPoints()
  103.         frame:SetPoint("CENTER", -451, 60)
  104.         Options3:SetScript("OnClick", ReloadUI)
  105.                         --Button9
  106.             local frame = CreateFrame("Button", "Options9", Config_BaseFrame, "UIPanelButtonTemplate")
  107.             frame:SetHeight(36)
  108.             frame:SetWidth(67)
  109.             frame:SetText("Opt9")
  110.             frame:ClearAllPoints()
  111.             frame:SetPoint("CENTER", 451, 60)
  112.             Options9:SetScript("OnClick", ReloadUI)
  113.         --Button4
  114.         local frame = CreateFrame("Button", "Options4", Config_BaseFrame, "UIPanelButtonTemplate")
  115.         frame:SetHeight(36)
  116.         frame:SetWidth(67)
  117.         frame:SetText("Opt4")
  118.         frame:ClearAllPoints()
  119.         frame:SetPoint("CENTER", -451, 10)
  120.         Options4:SetScript("OnClick", ReloadUI)
  121.                         --Button10
  122.             local frame = CreateFrame("Button", "Options10", Config_BaseFrame, "UIPanelButtonTemplate")
  123.             frame:SetHeight(36)
  124.             frame:SetWidth(67)
  125.             frame:SetText("Opt10")
  126.             frame:ClearAllPoints()
  127.             frame:SetPoint("CENTER", 451, 10)
  128.             Options10:SetScript("OnClick", ReloadUI)
  129.         --Button5
  130.         local frame = CreateFrame("Button", "Options5", Config_BaseFrame, "UIPanelButtonTemplate")
  131.         frame:SetHeight(36)
  132.         frame:SetWidth(67)
  133.         frame:SetText("Opt5")
  134.         frame:ClearAllPoints()
  135.         frame:SetPoint("CENTER", -451, -40)
  136.         Options5:SetScript("OnClick", ReloadUI)
  137.                         --Button11
  138.             local frame = CreateFrame("Button", "Options11", Config_BaseFrame, "UIPanelButtonTemplate")
  139.             frame:SetHeight(36)
  140.             frame:SetWidth(67)
  141.             frame:SetText("Opt11")
  142.             frame:ClearAllPoints()
  143.             frame:SetPoint("CENTER", 451, -40)
  144.             Options11:SetScript("OnClick", ReloadUI)
  145.         --Button6
  146.         local frame = CreateFrame("Button", "Options6", Config_BaseFrame, "UIPanelButtonTemplate")
  147.         frame:SetHeight(36)
  148.         frame:SetWidth(67)
  149.         frame:SetText("Opt6")
  150.         frame:ClearAllPoints()
  151.         frame:SetPoint("CENTER", -451, -90)
  152.         Options6:SetScript("OnClick", ReloadUI)
  153.        
  154.                         --Button12
  155.             local frame = CreateFrame("Button", "Options12", Config_BaseFrame, "UIPanelButtonTemplate")
  156.             frame:SetHeight(36)
  157.             frame:SetWidth(67)
  158.             frame:SetText("Opt12")
  159.             frame:ClearAllPoints()
  160.             frame:SetPoint("CENTER", 451, -90)
  161.             Options12:SetScript("OnClick", ReloadUI)
  162.        
  163. --  Setting the background for Config_BaseFrame for Right side
  164.     Config_BaseFrame.portrait = Config_BaseFrame:CreateTexture("Config_BaseFrame_Portrait", "BACKGROUND")
  165.     Config_BaseFrame.portrait:SetWidth(512)
  166.     Config_BaseFrame.portrait:SetHeight(512)
  167.     Config_BaseFrame.portrait:SetPoint("TOPRIGHT", 0, 0)
  168.     Config_BaseFrame.portrait:SetTexture("Interface\\Addons\\Deranjata\\Media\\UI-GuildBankFrame-Right.tga")
  169.  
  170. end
  Reply With Quote