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).