Yea totally sweet! And i am using meta tables... here is my metatable setup. Im still having issues with the party frames im down to making the code that makes it switch party styles... it does not like my dropdownmnu selection one bit....
here is my metatable setup in my core though which btw you can dump the metatable with the /dump to.
lua Code:
local eventFrame = CreateFrame("Frame", nil, UIParent)
eventFrame:RegisterEvent("PLAYER_LOGIN")
eventFrame:SetScript("OnEvent", function()
GrimUI.Data = setmetatable(GrimUIData, defaults)
for name, module in pairs(modules) do
if module.OnFirstLoad and not GrimUIData.modsConfigured[name] then
module:OnFirstLoad(GrimUIData)
GrimUIData.modsConfigured[name] = true
end
if module.OnInitialize then
module:OnInitialize()
end
end
end)
this following code is my dropdown menu. this is the second one i have made i think the problem is with the use of locals being the same in both of the dropdown menus code... ill post both the one for artskins works just fine. soon as i add the one for the party frame style it freaks out...
artskins -
lua Code:
GrimUISkinMenu = CreateFrame("Frame", "GrimUISkinMenu", GrimOptionsPanel, "UIDropDownMenuTemplate");
GrimUISkinMenu:ClearAllPoints()
GrimUISkinMenu:SetPoint("LEFT",GrimOptionsPanel, 0, 95);
GrimUISkinMenu:Show()
name = GrimUISkinMenu:CreateFontString()
name:SetPoint('LEFT', GrimUISkinMenu, 'RIGHT', -5, 0)
name:SetFontObject(GameFontNormal)
name:SetText('Art Skin')
-- info.text = "First Menu Item"; --the text of the menu item
-- info.value = 0; -- the value of the menu item. This can be a string also.
-- info.func = function() MyDropDownMenuItem_OnClick() end; --sets the function to execute when this item is clicked
-- info.owner = this:GetParent(); --binds the drop down menu as the parent of the menu item. This is very important for dynamic drop down menues.
-- info.checked = nil; --initially set the menu item to being unchecked with a yellow tick
-- info.icon = nil; --we can use this to set an icon for the drop down menu item to accompany the text
-- UIDropDownMenu_AddButton(info, level); --Adds the new button to the drop down menu specified in the UIDropDownMenu_Initialise function. In this case, it's MyDropDownMenu
-- info.text = "Second Menu Item";
-- info.value = 1;
-- info.func = function() MyDropDownMenuItem_OnClick() end;
-- info.owner = this:GetParent();
-- info.checked = nil;
-- info.icon = nil;
-- UIDropDownMenu_AddButton(info, level);
local items = {
"Horde Skin 1",
"Alliance Skin 1",
"Black Metal Skin by Noob123 ",
"Alliance Skin 2",
}
local function OnClick(self)
UIDropDownMenu_SetSelectedID(GrimUISkinMenu, self:GetID())
GrimUIData.ArtSkinNumb = self.value
GrimUI:GetModule("ArtSkins"):UpdateSkin()
end
local function initialize(self, level)
for k,v in pairs(items) do
info = UIDropDownMenu_CreateInfo()
info.text = v
info.value = k
info.func = OnClick
UIDropDownMenu_AddButton(info, level)
end
end
UIDropDownMenu_Initialize(GrimUISkinMenu, initialize)
UIDropDownMenu_SetWidth(GrimUISkinMenu, 100);
UIDropDownMenu_SetButtonWidth(GrimUISkinMenu, 124)
UIDropDownMenu_SetSelectedID(GrimUISkinMenu, 1)
UIDropDownMenu_JustifyText(GrimUISkinMenu, "LEFT")
and then this is the one for the style selection but it does not work it of course comes after the one i posted above but in the same file. Neither of which are in any file related to what they do which is why there are global function calls from my other files... two different methods and maybe the method im using is the problem. maybe someone has an idea?
lua Code:
------------------------------------
-- GrimUI PartyFrame Layout style menue
----------------
GrimUIPartyStyleMenu = CreateFrame("Frame", "GrimUIPartyStyleMenu", GrimOptionsPanel, "UIDropDownMenuTemplate");
GrimUIPartyStyleMenu:ClearAllPoints()
GrimUIPartyStyleMenu:SetPoint("LEFT",GrimOptionsPanel, 0, 70);
GrimUIPartyStyleMenu:Show()
name = GrimUIPartyStyleMenu:CreateFontString()
name:SetPoint('LEFT', GrimUIPartyStyleMenu, 'RIGHT', -5, 0)
name:SetFontObject(GameFontNormal)
name:SetText('Party Frame Style')
local items = {
"Vertical Style",
"Horizontal Style",
}
local function OnClick(self)
UIDropDownMenu_SetSelectedID(GrimUIPartyStyleMenu, self:GetID())
GrimUIData.GUIPartyStyle = self.value
GrimUI.UpdatePartyStyle()
GrimUI.Party1LayoutInitiate()
GrimUI.Party2LayoutInitiate()
GrimUI.Party3LayoutInitiate()
GrimUI.Party4LayoutInitiate()
end
local function initialize(self, level)
for k,v in pairs(items) do
info = UIDropDownMenu_CreateInfo()
info.text = v
info.value = k
info.func = OnClick
UIDropDownMenu_AddButton(info, level)
end
end
UIDropDownMenu_Initialize(GrimUIPartyStyleMenu, initialize)
UIDropDownMenu_SetWidth(GrimUIPartyStyleMenu, 100);
UIDropDownMenu_SetButtonWidth(GrimUIPartyStyleMenu, 124)
UIDropDownMenu_SetSelectedID(GrimUIPartyStyleMenu, 1)
UIDropDownMenu_JustifyText(GrimUIPartyStyleMenu, "LEFT")