view Gui.lua @ 37:6362fe301d43

Storing class name in the persons so we can color them in later Exposing some data lists, but this will likely be retracted later in favor of interface functions
author John@Yosemite-PC
date Tue, 13 Mar 2012 23:17:18 -0400
parents 21c58930f74e
children 7bfbff27a3d7
line wrap: on
line source

local ChangeTab = function(container, event, group)
    container:ReleaseChildren()
    if group == "tab2" then
        local desc = AceGUI:Create("Label")
        desc:SetText("This is Tab 1")
        desc:SetFullWidth(true)
        container:AddChild(desc)

        local button = AceGUI:Create("Button")
        button:SetText("Tab 1 Button")
        button:SetWidth(200)
        container:AddChild(button)
    elseif group == "tab1" then
        local item2 = {string="item2!", color = {r=1,g=0,b=0.5} }
        local itemList = {"Item1", item2, "Item3", "Item4"}

        local myMultiSelect = AceGUI:Create("MultiSelect")
        myMultiSelect:SetLabel("My Multi Select")
        myMultiSelect:SetWidth(200)
        myMultiSelect:SetHeight(400)
        myMultiSelect:SetItemList(itemList)
        myMultiSelect:SetMultiSelect(false)
        container:AddChild(myMultiSelect)
    end
end

function bsk:CreateGUI()

    -- Create a container frame
    self.frame = AceGUI:Create("Frame")
    self.frame:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end)
    self.frame:SetTitle("BSK")
    self.frame:SetLayout("Flow")
    self.frame:SetHeight(700) 
    self.frame:SetWidth(350)
    local tab = AceGUI:Create("TabGroup")
    tab:SetLayout("Flow")
    tab:SetTabs(
        {
            {
                text="Tab 1",
                value="tab1"
            },

            {
                text="Tab 2",
                value="tab2"
            },
            {
                text="Tab 3",
                value="tab3"
            },
            {
                text="Tab 4",
                value="tab4"
            }
        }
    )
	tab.width = "fill"
	tab.height = "fill"

    tab:SetCallback("OnGroupSelected",ChangeTab)
    tab:SelectTab("tab1")
    self.frame:AddChild(tab)

    -- Create a button
    --local btn = AceGUI:Create("Button")
    --btn:SetWidth(170)
    --btn:SetText("Button !")
    --btn:SetCallback("OnClick", function() print("Click!") end)
    -- Add the button to the container
    --self.frame:AddChild(btn)
end