Thread Tools Display Modes
10-30-19, 12:03 AM   #1
Rykkan
A Defias Bandit
Join Date: Oct 2019
Posts: 3
Right-click on target menu

I have fixed the BlackList addon to work with WoW Classic. But I cannot get the drop down item when right clicking a player to not be grayed out. Looking for help. It correctly places the menu item under Other Options and names it correctly. But I am not sure why it is grayed out and not usable.

This is the code for the menu:

function BlackList:AddMenuItems()
UnitPopupButtons["AddtoBlacklist"] = { text = "BlackList", dist = 0 }

--Insert it to the end -1
tinsert(UnitPopupMenus["PARTY"], (#UnitPopupMenus["PARTY"])-1, "AddtoBlacklist")
tinsert(UnitPopupMenus["RAID_PLAYER"], (#UnitPopupMenus["RAID_PLAYER"])-1, "AddtoBlacklist")
tinsert(UnitPopupMenus["PLAYER"], (#UnitPopupMenus["PLAYER"])-1, "AddtoBlacklist")
tinsert(UnitPopupMenus["CHAT_ROSTER"], (#UnitPopupMenus["CHAT_ROSTER"])-1, "AddtoBlacklist")
tinsert(UnitPopupMenus["FRIEND"], (#UnitPopupMenus["FRIEND"])-1, "AddtoBlacklist")

hooksecurefunc("UnitPopup_OnClick", function()
if (self.value == "AddtoBlacklist") then
local dropdownMenu = _G["UIDROPDOWNMENU_INIT_MENU"]
if(dropdownMenu.name ~= UnitName("player")) then
BlackList:AddPlayer(dropdownMenu.name)
end
end
end)

end

Last edited by Rykkan : 10-30-19 at 12:52 PM.
  Reply With Quote
10-30-19, 02:23 PM   #2
Rykkan
A Defias Bandit
Join Date: Oct 2019
Posts: 3
I have tried multiple ways to try to fix this, but no matter what I try that selection is always grayed out in the player/target dropdown menu when right-clicking their portrait.
  Reply With Quote
10-31-19, 02:29 AM   #3
erispope
A Deviate Faerie Dragon
Join Date: Sep 2019
Posts: 10
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?
  Reply With Quote
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

WoWInterface » Developer Discussions » Lua/XML Help » Right-click on target menu

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off