Thread Tools Display Modes
09-14-12, 07:04 AM   #1
another
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 11
Problem with "EasyMenu" - need help

Was trying to ask on US "UI and Macro" without success. Can't solve riddle with EasyMenu.
Simple test addon:
test.xml
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
	..\FrameXML\UI.xsd">

	<Frame name="MyContainerFrameTemplate" inherits="SecureHandlerStateTemplate" hidden="true" enableMouse="true" movable="true" frameStrata="MEDIUM" clampedToScreen="true" virtual="true">
		<ResizeBounds>
			<minResize>
				<AbsDimension x="40" y="40"/>
			</minResize>
			<maxResize>
				<AbsDimension x="400" y="400"/>
			</maxResize>
		</ResizeBounds>
		<Backdrop bgFile="Interface/DialogFrame/UI-DialogBox-Background" edgeFile="Interface/DialogFrame/UI-DialogBox-Border" tile="true">
			<EdgeSize>
				<AbsValue val="16"/>
			</EdgeSize>
			<TileSize>
				<AbsValue val="16"/>
			</TileSize>
			<BackgroundInsets>
				<AbsInset left="5" right="5" top="5" bottom="5"/>
			</BackgroundInsets>
		</Backdrop>
		<Frames>
			<Button name="$parentConfigure">
				<Size>
					<AbsDimension x="16" y="16"/>
				</Size>
				<Anchors>
					<Anchor point="BOTTOMRIGHT" x="-25" y="6"/>
				</Anchors>
				<Layers>
					<Layer level="HIGHLIGHT">
						<Texture name="$parentHighlight" parentKey="highlight" file="Interface/Minimap/UI-Minimap-ZoomButton-Highlight" alphaMode="ADD">
							<Size>
								<AbsDimension x="34" y="34"/>
							</Size>
							<Anchors>
								<Anchor point="CENTER"/>
							</Anchors>
						</Texture>
					</Layer>
				</Layers>
				<NormalTexture file="Interface/Icons/inv_misc_gear_01"/>
				<HighlightTexture file="Interface/Icons/inv_misc_gear_01"/>
				<Scripts>
					<OnClick>
						Container_OnSubmenu(self, self:GetParent())
					</OnClick>
				</Scripts>
			</Button>
		</Frames>
		<Scripts>
			<OnMouseDown>
				self:StartMoving()
			</OnMouseDown>
			<OnMouseUp>
				self:StopMovingOrSizing()
			</OnMouseUp>
		</Scripts>
	</Frame>
</Ui>
test.lua
Code:
local function SetMenuItemChecked(self)
end

local tabsSubmenu = {
	{ text = "Add new tab", func = todo, notCheckable = true, keepShownOnClick = false },
	{ text = "-----------", notCheckable = true, notClickable = true },
	{ text = "Remove tab", func = todo, notCheckable = true, keepShownOnClick = false },
}

local talentSubmenu = {
	{ text = "1", func = todo, checked = true, keepShownOnClick = true },
	{ text = "2", func = todo, checked = true, keepShownOnClick = true },
}

local tabMenu = {
	{ text = "Tabs", value = text, menuList = tabsSubmenu, hasArrow = true, notCheckable = true, keepShownOnClick = true }, --1
	{ text = "Title", value = text, func = todo, notCheckable = true, keepShownOnClick = true }, --2
	{ text = "Talents", value = text, menuList = talentSubmenu, hasArrow = true, notCheckable = true, keepShownOnClick = true }, --3
	{ text = "Show grid", value = text, func = SetMenuItemChecked, checked = true, keepShownOnClick = true, arg1 = 4 }, --4
	{ text = "Show tooltip", value = text, func = SetMenuItemChecked, checked = true, keepShownOnClick = true, arg1 = 5 }, --5
	{ text = "Locked", value = text, func = SetMenuItemChecked, checked = true, keepShownOnClick = true, arg1 = 6 }, --6
	{ text = "Visibility", value = text, func = todo, notCheckable = true, keepShownOnClick = true }, --7
	{ text = "Close", notCheckable = true, keepShownOnClick = false }, --8
}
		
function Container_OnSubmenu(self, container)
	EasyMenu(tabMenu, container, "cursor", 0, 0, nil) 
	--EasyMenu(tabMenu, self, "cursor", 0, 0, nil)
end

function Container_New(id, left, top)
	local container = CreateFrame('Frame', 'ContainerFrame'..id, UIParent, 'MyContainerFrameTemplate')
	container:ClearAllPoints()
	container:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", left, top)
	
	container:SetWidth(300)
	container:SetHeight(100)
	
	return container
end

local cnt = Container_New(1, 500, 400)
cnt:Show()
in .toc
Code:
...
test.xml
test.lua
pressing button to show dropdown menu causes changes in height of window or button (menuFrame in terms of EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay)).
How to avoid resizing?

Was tinkering trying to make yet another extra bars for fun (there is a lot working, but still ...) since I have lot of button stuff already done (just put things together into containers with tabs and submenu).
  Reply With Quote
09-14-12, 06:17 PM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
I recommend reading this: http://forums.wowace.com/showthread.php?t=15763
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
09-15-12, 07:19 AM   #3
another
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 11
There or dummy invisible frame or inherited from UIDropDownMenuTemplate in case of "MENU" option. So basically Blizzard's EasyMenu code bugged and people avoiding it with dummy frames as I understand.
http://www.wowwiki.com/API_EasyMenu only say "menuFrame Frame - a Frame object that will be used to store some information about the menu."

Thanks.
  Reply With Quote
09-15-12, 09:06 AM   #4
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
WoWWiki is severely outdated since most of the admins/editors started WoWPedia in 2010. Look at their entry here: http://www.wowpedia.org/API_EasyMenu
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Problem with "EasyMenu" - need help


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