I'm having trouble getting dropdown menus working correctly.
I have things *almost* working, but whenever I select a choice from the menu, all items from the one I selected up to the last one end up with a check mark beside them. What am I doing wrong?
Here is a very short test addon in its entirety that demonstrates the problem, in case anyone wants to try it.
First the .lua file:
Code:
function Test_DropDownInitialize()
local entry = { func = Test_DropDownOnClick; }
entry.text = "One"; entry.value = 101; UIDropDownMenu_AddButton(entry)
entry.text = "Two"; entry.value = 102; UIDropDownMenu_AddButton(entry)
entry.text = "Three"; entry.value = 103; UIDropDownMenu_AddButton(entry)
entry.text = "Four"; entry.value = 104; UIDropDownMenu_AddButton(entry)
end
function Test_DropDownOnClick()
UIDropDownMenu_SetSelectedID( Test_dropdown, this:GetID() );
end
The XML file:
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/ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
<Script file="Test.lua"/>
<Frame name="TestMainFrame" frameStrata="HIGH" parent="UIParent" hidden="false" toplevel="true" enableMouse="true" movable="true">
<Scripts>
<OnMouseDown>
this:StartMoving();
</OnMouseDown>
<OnMouseUp>
this:StopMovingOrSizing();
</OnMouseUp>
</Scripts>
<Size>
<AbsDimension x="200" y="100"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Backdrop name="$parentBackdrop" bgFile="Interface\TutorialFrame\TutorialFrameBackground" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="32"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5"/>
</BackgroundInsets>
</Backdrop>
<Layers>
<Layer level="ARTWORK">
<Texture file="Interface\DialogFrame\UI-DialogBox-Header">
<Size><AbsDimension x="256" y="64"/></Size>
<Anchors>
<Anchor point="TOP">
<Offset><AbsDimension x="0" y="12"/></Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Frames>
<Button name="Test_dropdown" inherits="UIDropDownMenuTemplate">
<Size>
<AbsDimension x="48" y="24"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset><AbsDimension x="30" y="-40"/></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnShow>
UIDropDownMenu_Initialize( this, Test_DropDownInitialize );
</OnShow>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>
And the TOC file:
Code:
## Title: Test
## Interface: 1800
## Version: 0.01
## Notes: Test
Test.xml