Thread Tools Display Modes
12/14/14, 05:49 AM   #1
BornDownUnder
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 59
Right-Click Toggling for Drop-Down Menu Display.

As title states, it is my intention to have a drop-down menu that displays only when you right-click on a bar...

Everything seems set up just fine, the menu is perfect in display, functionality, just first time the bar is displayed per session the drop down menu is displayed as well.

Here are the bits of code that I can see as having an involvement in the issue, the rest is just variables for the display of the menu options (Taken from WLGF):
Code:
local function WLGF_RightClick_HideAll()
	for i = 1, 4, 1 do
		if (WLGF["RC_BG_group"..i] ~= nil) then
			WLGF["RC_BG_group"..i]:SetHidden(true)
		end
	end
end --WLGF_RightClick_HideAll()

	if (WLGF["RC_BG_"..owner]:IsHidden()) then

		WLGF["RC_BG_"..owner]:SetAnchor(BOTTOMLEFT, GuiRoot, TOPLEFT, mouseLeft,mouseTop)
		WLGF["RC_BG_"..owner]:SetHidden(false)

local function WLGF_RightClick_Click(button, owner)
	if (button == 2) then
		WLGF_RightClick_Toogle(owner)
	else
		WLGF["RC_BG_"..owner]:SetHidden(true)
	end
end --WLGF_RightClick_Click()

		WLGF["RC_BG_"..owner] = Chain(WINDOW_MANAGER:CreateControl("WLGF_RC_BG_"..owner, WLGF["Anchor_group"..num], CT_BACKDROP))
			:SetDimensions(200,100)
			:SetCenterTexture(center_tex)
			:SetEdgeTexture(edge_tex, 128, 16)
			:SetInsets(16,16,-16,-16)
			:SetDrawLayer(1)
			:SetHidden(false)
		.__END
Can anybody see in that code as to why the menu displays automatically upon group creation, only once, always the first group creation per play session

Note: WLGF is WarLegendsGroupFrames, I am planning on updating it and releasing it once I hear back from Lyeos.
  Reply With Quote
12/14/14, 09:33 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by BornDownUnder View Post
...<snip>...

Can anybody see in that code as to why the menu displays automatically upon group creation, only once, always the first group creation per play session

...<snip>...
Menu is displayed because you made it visible. see the difference:
Lua Code:
  1. --origial code:
  2.         WLGF["RC_BG_"..owner] = Chain(WINDOW_MANAGER:CreateControl("WLGF_RC_BG_"..owner, WLGF["Anchor_group"..num], CT_BACKDROP))
  3.             :SetDimensions(200,100)
  4.             :SetCenterTexture(center_tex)
  5.             :SetEdgeTexture(edge_tex, 128, 16)
  6.             :SetInsets(16,16,-16,-16)
  7.             :SetDrawLayer(1)
  8.             :SetHidden(true)
  9.         .__END
  10. --your code:
  11.         WLGF["RC_BG_"..owner] = Chain(WINDOW_MANAGER:CreateControl("WLGF_RC_BG_"..owner, WLGF["Anchor_group"..num], CT_BACKDROP))
  12.             :SetDimensions(200,100)
  13.             :SetCenterTexture(center_tex)
  14.             :SetEdgeTexture(edge_tex, 128, 16)
  15.             :SetInsets(16,16,-16,-16)
  16.             :SetDrawLayer(1)
  17.             :SetHidden(false)
  18.         .__END
  Reply With Quote
12/14/14, 08:42 PM   #3
BornDownUnder
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 59
Thumbs up

Originally Posted by Garkin View Post
Menu is displayed because you made it visible.
zomg! I can't believe I didn't pick that up... I think from now on no more pulling near all-nighters to do code
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Right-Click Toggling for Drop-Down Menu Display.


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