Unibus
14-02-2007, 12:55 AM
Hi
I'm trying to make a button, that when pressed it will show a Drop Down Menu with the current online friends in it.
This far i've made the button:
<Button name="WE_Friends" inherits="UIPanelButtonTemplate2" text="F" hidden="False" toplevel="true">
<Size>
<AbsDimension x="15" y="20"/>
</Size>
<Anchors>
<Anchor point="Right" relativeTo="WE_Exit" relativePoint="Left">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
MyDropDownMenuButton_OnClick();
</OnClick>
<OnEnter>
WE_DisplayTooltip("Friends",this);
</OnEnter>
<OnLeave>
We_Tooltip:Hide();
</OnLeave>
</Scripts>
</Button>
And the Drop Down Frame:
<Frame name="MyDropDownMenu" inherits="UIDropDownMenuTemplate" id="1">
<Scripts>
<OnLoad>
UIDropDownMenu_Initialize(this, MyDropDownMenu_OnLoad, "MENU");
</OnLoad>
</Scripts>
</Frame>
And the Lua Code for it:
function MyDropDownMenu_OnLoad()
local info = {};
info.text = "Friends Online";
info.notClickable = 1;
info.isTitle = 1;
UIDropDownMenu_AddButton(info);
local info = {};
info.text = "[Test Friend1]";
info.value = "OptionVariable";
info.func = WE_WhipserName();
UIDropDownMenu_AddButton(info);
local info = {};
info.text = "[Test Friend2]";
info.value = "OptionVariable";
info.func = WE_WhipserName();
UIDropDownMenu_AddButton(info);
end
function MyDropDownMenuButton_OnClick()
ToggleDropDownMenu(1, nil, MyDropDownMenu , WE_Exit, -10, 0);
end
function WE_WhipserName()
DEFAULT_CHAT_FRAME:AddMessage("It Works")
end
(Don't mind the WE_Exit anchor.)
But every time i load the addon, all the functions (info.func) are triggered. So i get "It Works"x2 when i load the interface and "It Works"x2 when i press the "WE_Friends" button. But no respons when i clikc an option in the dropdown menu.
Can anyone help me ?? plz :cry:
Thanks :grin:
I'm trying to make a button, that when pressed it will show a Drop Down Menu with the current online friends in it.
This far i've made the button:
<Button name="WE_Friends" inherits="UIPanelButtonTemplate2" text="F" hidden="False" toplevel="true">
<Size>
<AbsDimension x="15" y="20"/>
</Size>
<Anchors>
<Anchor point="Right" relativeTo="WE_Exit" relativePoint="Left">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
MyDropDownMenuButton_OnClick();
</OnClick>
<OnEnter>
WE_DisplayTooltip("Friends",this);
</OnEnter>
<OnLeave>
We_Tooltip:Hide();
</OnLeave>
</Scripts>
</Button>
And the Drop Down Frame:
<Frame name="MyDropDownMenu" inherits="UIDropDownMenuTemplate" id="1">
<Scripts>
<OnLoad>
UIDropDownMenu_Initialize(this, MyDropDownMenu_OnLoad, "MENU");
</OnLoad>
</Scripts>
</Frame>
And the Lua Code for it:
function MyDropDownMenu_OnLoad()
local info = {};
info.text = "Friends Online";
info.notClickable = 1;
info.isTitle = 1;
UIDropDownMenu_AddButton(info);
local info = {};
info.text = "[Test Friend1]";
info.value = "OptionVariable";
info.func = WE_WhipserName();
UIDropDownMenu_AddButton(info);
local info = {};
info.text = "[Test Friend2]";
info.value = "OptionVariable";
info.func = WE_WhipserName();
UIDropDownMenu_AddButton(info);
end
function MyDropDownMenuButton_OnClick()
ToggleDropDownMenu(1, nil, MyDropDownMenu , WE_Exit, -10, 0);
end
function WE_WhipserName()
DEFAULT_CHAT_FRAME:AddMessage("It Works")
end
(Don't mind the WE_Exit anchor.)
But every time i load the addon, all the functions (info.func) are triggered. So i get "It Works"x2 when i load the interface and "It Works"x2 when i press the "WE_Friends" button. But no respons when i clikc an option in the dropdown menu.
Can anyone help me ?? plz :cry:
Thanks :grin: