Quantcast WoWInterface - View Single Post - Creating a frame within a frame
View Single Post
05-20-17, 12:53 PM   #1
Asalas77
A Murloc Raider
Join Date: May 2017
Posts: 9
Creating a frame within a frame

Hello, I am trying to create a dropdown menu using this tutorial http://wow.gamepedia.com/Using_UIDropDownMenu

But instead of having in on UIParent, I want to stick it inside my addon frame.

Here's my code, i changed 'UIParent' to 'Main' (my frame) as 3rd argument but the list is still drawn on on parent. I tried I to write 'Main:CreateFrame...' but the dropdown list dissapears completely.

lua Code:
  1. raids = {'Naxxramas','Vault of Archavon','Obsidian Sanctum','Ulduar','The Eye of Eternity','Trial of the Crusader','Onyxia\'s Lair','Icecrown Citadel','Ruby Sanctum'}
  2. raid_values ={'naxx','voa','os','uldu','eoe','toc','onyxia','icc','rs'}
  3.  
  4. local raid;
  5.  
  6. local dropDown = CreateFrame("Frame", "raidDrop", Main, "UIDropDownMenuTemplate")
  7. dropDown:SetPoint("CENTER",0,0)
  8. UIDropDownMenu_SetWidth(dropDown, 80)
  9. UIDropDownMenu_SetText(dropDown,raid)
  10.  
  11.  
  12. UIDropDownMenu_Initialize(dropDown, function(self, level, menuList)
  13.  local info = UIDropDownMenu_CreateInfo()
  14.   for i=1,9 do
  15.    info.text, info.arg1, info.checked = raids[i], raid_values[i], false
  16.     info.func = self.SetValue
  17.    UIDropDownMenu_AddButton(info)
  18.  end
  19. end)
  20.  
  21.  
  22. function dropDown:SetValue(newValue)
  23.  raid = newValue
  24.  UIDropDownMenu_SetText(dropDown,raid)
  25.  CloseDropDownMenus()
  26. end

Last edited by Asalas77 : 05-20-17 at 01:03 PM.