Thread Tools Display Modes
09/26/14, 02:38 AM   #1
Godwyn74
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 2
Update4 rightclick chatmenu problem

Hi there ppl since update 4 api 100009 i have a problim with my code.
I was able to fix the rightclicking in the chatwindow to show my own context menu.
However the original context menu dissapeared with it.
Can anyone help me to add my menu items on te original context menu?

Code:
local function Clicked(link, button, control, _, linkType)
	ClearMenu()
	local pname = (string.sub(control, 2, -2))
	if isdebug then
		d("Name used for invite: "..pname)
	end	
		
    if button == 2 then
        ZO_Menu:SetHidden(true)
		numGuilds = GetNumGuilds()
		for i=1,numGuilds do
			local gid = GetGuildId(i)
			if(DoesPlayerHaveGuildPermission(gid,GUILD_PERMISSION_INVITE) == true) then
				local guildName = GetGuildName(gid)
				AddMenuItem(string.format(Trans.GUILDINVITE,guildName), function() addPlayerToGuild(pname, gid, guildName) end)
			end
		end
		ShowMenu(control)
    end
end
  Reply With Quote
09/26/14, 07:26 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by Godwyn74 View Post
Hi there ppl since update 4 api 100009 i have a problim with my code.
I was able to fix the rightclicking in the chatwindow to show my own context menu.
However the original context menu dissapeared with it.
Can anyone help me to add my menu items on te original context menu?

Code:
local function Clicked(link, button, control, _, linkType)
	ClearMenu()
	local pname = (string.sub(control, 2, -2))
	if isdebug then
		d("Name used for invite: "..pname)
	end	
		
    if button == 2 then
        ZO_Menu:SetHidden(true)
		numGuilds = GetNumGuilds()
		for i=1,numGuilds do
			local gid = GetGuildId(i)
			if(DoesPlayerHaveGuildPermission(gid,GUILD_PERMISSION_INVITE) == true) then
				local guildName = GetGuildName(gid)
				AddMenuItem(string.format(Trans.GUILDINVITE,guildName), function() addPlayerToGuild(pname, gid, guildName) end)
			end
		end
		ShowMenu(control)
    end
end
Function ClearMenu() removes all previously added items from the the context menu. If you want to keep already added items, do not call this function.

But I'd use different way how to add guild invite items to the context menu - hook function CHAT_SYSTEM:ShowPlayerContextMenu(playerName, rawName).

Warning: Spoiler
  Reply With Quote
09/26/14, 01:55 PM   #3
Godwyn74
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 2
Wow mate you fixed it
Thanks alot!
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Update4 rightclick chatmenu problem


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