View Single Post
11-01-19, 11:48 AM   #4
Rykkan
A Defias Bandit
Join Date: Oct 2019
Posts: 3
Originally Posted by erispope View Post
How does the code that controls the disabled state for that menu look like?

Is there a function for enabling or disabling each choice that is not present for the blacklist choice?
I couldn't find anything, but i found changing it to from PopUpButton to just adding it to the UIDROPDOWNMENU it worked.
local function blackListButton(self)
if self.value == "BlacklistButton" then
-- print("RedButton clicked")
local dropdownMenu = _G["UIDROPDOWNMENU_INIT_MENU"]
if(dropdownMenu.name ~= UnitName("player")) then
BlackList:AddPlayer(dropdownMenu.name)
end
else
print(" WTF how did I fail?")
end
end

hooksecurefunc("UnitPopup_ShowMenu", function()
if (UIDROPDOWNMENU_MENU_LEVEL > 1) then
return
end
local info = UIDropDownMenu_CreateInfo()
info.text = "Add to BlackList"
info.owner = which
info.notCheckable = 1
info.func = blackListButton
info.colorCode = "|cffff0000"
info.value = "BlacklistButton"

UIDropDownMenu_AddButton(info)
end)

  Reply With Quote