Mercurial > wow > breuesk
comparison Gui.lua @ 1:21c58930f74e
Refactoring
| author | John@Yosemite-PC |
|---|---|
| date | Fri, 02 Mar 2012 22:32:12 -0500 |
| parents | |
| children | 7bfbff27a3d7 |
comparison
equal
deleted
inserted
replaced
| 0:47fac96968e1 | 1:21c58930f74e |
|---|---|
| 1 | |
| 2 local ChangeTab = function(container, event, group) | |
| 3 container:ReleaseChildren() | |
| 4 if group == "tab2" then | |
| 5 local desc = AceGUI:Create("Label") | |
| 6 desc:SetText("This is Tab 1") | |
| 7 desc:SetFullWidth(true) | |
| 8 container:AddChild(desc) | |
| 9 | |
| 10 local button = AceGUI:Create("Button") | |
| 11 button:SetText("Tab 1 Button") | |
| 12 button:SetWidth(200) | |
| 13 container:AddChild(button) | |
| 14 elseif group == "tab1" then | |
| 15 local item2 = {string="item2!", color = {r=1,g=0,b=0.5} } | |
| 16 local itemList = {"Item1", item2, "Item3", "Item4"} | |
| 17 | |
| 18 local myMultiSelect = AceGUI:Create("MultiSelect") | |
| 19 myMultiSelect:SetLabel("My Multi Select") | |
| 20 myMultiSelect:SetWidth(200) | |
| 21 myMultiSelect:SetHeight(400) | |
| 22 myMultiSelect:SetItemList(itemList) | |
| 23 myMultiSelect:SetMultiSelect(false) | |
| 24 container:AddChild(myMultiSelect) | |
| 25 end | |
| 26 end | |
| 27 | |
| 28 function bsk:CreateGUI() | |
| 29 | |
| 30 -- Create a container frame | |
| 31 self.frame = AceGUI:Create("Frame") | |
| 32 self.frame:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end) | |
| 33 self.frame:SetTitle("BSK") | |
| 34 self.frame:SetLayout("Flow") | |
| 35 self.frame:SetHeight(700) | |
| 36 self.frame:SetWidth(350) | |
| 37 local tab = AceGUI:Create("TabGroup") | |
| 38 tab:SetLayout("Flow") | |
| 39 tab:SetTabs( | |
| 40 { | |
| 41 { | |
| 42 text="Tab 1", | |
| 43 value="tab1" | |
| 44 }, | |
| 45 | |
| 46 { | |
| 47 text="Tab 2", | |
| 48 value="tab2" | |
| 49 }, | |
| 50 { | |
| 51 text="Tab 3", | |
| 52 value="tab3" | |
| 53 }, | |
| 54 { | |
| 55 text="Tab 4", | |
| 56 value="tab4" | |
| 57 } | |
| 58 } | |
| 59 ) | |
| 60 tab.width = "fill" | |
| 61 tab.height = "fill" | |
| 62 | |
| 63 tab:SetCallback("OnGroupSelected",ChangeTab) | |
| 64 tab:SelectTab("tab1") | |
| 65 self.frame:AddChild(tab) | |
| 66 | |
| 67 -- Create a button | |
| 68 --local btn = AceGUI:Create("Button") | |
| 69 --btn:SetWidth(170) | |
| 70 --btn:SetText("Button !") | |
| 71 --btn:SetCallback("OnClick", function() print("Click!") end) | |
| 72 -- Add the button to the container | |
| 73 --self.frame:AddChild(btn) | |
| 74 end | |
| 75 | |
| 76 |
