Quantcast
WoWInterface - View Single Post - HELP: DropdownMenu issue
View Single Post
09-19-19, 10:11 PM   #9
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Fizzlemizz View Post
Code:
dm = CreateFrame("FRAME", "SLFG_RoleMenu", panel, "UIDropDownMenuTemplate")
    dm:SetPoint("LEFT", SLFG_RoleText, "RIGHT", 0, -2)
    UIDropDownMenu_SetWidth(dm, 70)
    UIDropDownMenu_Initialize(dm, SLFG_RoleMenu_Init)
If this is the actual order of your code then this is calling SLFG_RoleMenu_Init before the function has been created so I'm guessing there is another version of it somewhere else also global.
Confirmed that there is no other SLFG_RoleMenu_init anywhere else, also moved the entire function before the dropdown creation, no change. This is the really odd thing; Here's a snippet from CFM with the exact same setup as my role dropdown and doesn't have this issue. See if you can notice a difference I'm missing (besides the resizing, etc.). The only major difference is that the self.func points to another outside function instead of being constructed locally, which I also set up and tested my current project, no change:

Lua Code:
  1. function SFM_CreatePanel2()
  2.     -- snipped
  3.     dm = CreateFrame("Frame", "SFM_FromBox", f, "UIDropDownMenuTemplate")
  4.         dm:SetPoint("LEFT", SFM_FromText, "RIGHT", -10, -2)
  5.         dm:SetScale(.75)
  6.         UIDropDownMenu_SetWidth(dm,105)
  7.         UIDropDownMenu_Initialize(dm, SFM_FromDropInit)
  8.     -- snipped
  9. end
  10.  
  11. function SFM_FromDropInit(self)
  12.     local info = UIDropDownMenu_CreateInfo()
  13.  
  14.     info.text = "CENTER"
  15.     info.value = 0
  16.     info.func = SFM_FromBoxClick
  17.     info.owner = self
  18.     info.checked = nil
  19.     info.icon = nil
  20.     UIDropDownMenu_AddButton(info)
  21.    
  22.     info.text = "TOP"
  23.     info.value = 1
  24.     info.func = SFM_FromBoxClick
  25.     info.owner = self
  26.     info.checked = nil
  27.     info.icon = nil
  28.     UIDropDownMenu_AddButton(info)
  29.  
  30.     -- snipped
  31. end
  32.  
  33. function SFM_FromBoxClick(self)
  34.     UIDropDownMenu_SetSelectedValue(self.owner, self.value)
  35.     if (self.value == 0) then
  36.         activeProfile[selName].point = "CENTER"
  37.     elseif (self.value == 1) then
  38.         activeProfile[selName].point = "TOP"
  39.     elseif (self.value == 2) then
  40.  
  41.     -- snipped
  42.     end
  43.     SFM_ApplySettings(selName)
  44. end

EDIT:

Last edited by Sythalin : 09-19-19 at 10:20 PM.
  Reply With Quote