Sorry for all the various questions, but I really am making progress I swear! :)
Question: How do I make the widgets go where I want them to? I'd like two buttons (in the code below, "save" and "cancel") to be in the bottom right of my dialog box. I've tried making dummy groups to try and trick the "Flow" layout into putting them there, but it isn't working for me. I've tried button:ClearAllPoints() and then button:SetPoint(...) but this sometimes fails (when giving it 5 arguments, like I've done elsewhere) or does nothing at all (when I give it 3 arguments).
Here's the relevant section of my code:
function Timer:changeTimer()
-- Create a container frame
self.configFrame = AceGUI:Create("Frame")
local f = self.configFrame
f:SetWidth(400)
f:SetHeight(320)
f:Show()
f:SetTitle("Timer Configuration")
f:SetLayout("Flow")
f.statusbg:Hide() -- We will need to undo this when we return the widget to the pool!
f.closebutton:Hide() -- We will need to undo this when we return the widget to the pool!
f:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end)
local ddg = AceGUI:Create("DropdownGroup")
ddg:SetTitle("Timer Type")
ddg:SetFullWidth(true)
ddg:SetLayout("List")
local timerTypes = {
[L["Cooldown"]] = L["Cooldown"],
[L["Buff"]] = L["Buff/Debuff"],
[L["Empty"]] = L["Empty"],
}
ddg:SetDropdownWidth(120)
ddg:SetGroupList(timerTypes)
local selfref = self
ddg:SetCallback("OnGroupSelected",function (self,event,selection)
selfref:changeTimerDependant(ddg,selection)
end)
ddg:SetGroup("Buff")
--[[
local spacer = AceGUI:Create("SimpleGroup")
spacer:SetFullWidth(true)
spacer:SetLayout("Flow")
local space = AceGUI:Create("SimpleGroup")
space:SetRelativeWidth(0.6)
]]
local save = AceGUI:Create("Button")
save:SetText("Save")
save:SetWidth(60)
save:SetHeight(20)
local cancel = AceGUI:Create("Button")
cancel:SetText("Cancel")
cancel:SetWidth(80)
cancel:SetHeight(20)
--spacer:AddChildren(space,save,cancel)
f:AddChildren(ddg,save,cancel)
cancel:ClearAllPoints()
cancel:SetPoint("BOTTOMRIGHT",0,0)
end
function Timer:changeTimerDependant(ddg,type)
if not self.configFrame then Clash:Print("in Timer:changeTimerDependant: no configFrame"); return end
ddg:ReleaseChildren()
local label = AceGUI:Create("Label")
label:SetFontObject("GameFontNormalSmall")
label:SetColor(0.9,0.9,0.9)
label:SetFullWidth(true)
local typeGroup = AceGUI:Create("SimpleGroup")
typeGroup:SetFullWidth(true)
if type == "Cooldown" then
label:SetText("\nThis timer type keeps track of the cooldown on one of you or your pet's spells or an item.\n")
local box = AceGUI:Create("EditBox")
box:SetLabel("Spell or Item Name:")
local targLabel = AceGUI:Create("Label")
targLabel:SetFontObject("GameFontNormalSmall")
targLabel:SetColor(1,0.82,0)
targLabel:SetText("\nAbility of:")
local targGroup = AceGUI:Create("SimpleGroup")
targGroup:SetFullWidth(true)
targGroup:SetLayout("Flow")
local rSelf = AceGUI:Create("CheckBox")
rSelf:SetType("radio")
rSelf:SetValue(true)
rSelf:SetLabel("Self")
rSelf:SetRelativeWidth(0.15)
rSelf:SetHeight(16)
local rPet = AceGUI:Create("CheckBox")
rPet:SetType("radio")
rPet:SetValue(false)
rPet:SetLabel("Pet")
rPet:SetRelativeWidth(0.15)
rPet:SetHeight(16)
local globalCheck = AceGUI:Create("CheckBox")
globalCheck:SetValue(false)
globalCheck:SetLabel("Account for global cooldown")
globalCheck:SetWidth(220)
globalCheck:SetCallback("OnEnter",function(widget)
GameTooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
local desc = L["globalCheck mouseover"]
GameTooltip:SetText(desc, 1, 1, 1, 1)
end)
globalCheck:SetCallback("OnLeave",function() GameTooltip:Hide() end)
targGroup:AddChildren(rSelf,rPet,globalCheck)
typeGroup:AddChildren(box,targLabel,targGroup)
elseif type == "Buff" then
label:SetText("\nThis timer type keeps track of a buff or debuff on a particular target.\n")
local box = AceGUI:Create("EditBox")
box:SetLabel("Effect Name:")
local targLabel = AceGUI:Create("Label")
targLabel:SetFontObject("GameFontNormalSmall")
targLabel:SetColor(1,0.8,0)
targLabel:SetText("\nEffect on:")
local targGroup = AceGUI:Create("SimpleGroup")
targGroup:SetFullWidth(true)
targGroup:SetLayout("Flow")
local rTarget = AceGUI:Create("CheckBox")
rTarget:SetType("radio")
rTarget:SetValue(true)
rTarget:SetLabel("Target")
rTarget:SetRelativeWidth(0.2)
rTarget:SetHeight(15)
local rFocus = AceGUI:Create("CheckBox")
rFocus:SetType("radio")
rFocus:SetValue(false)
rFocus:SetLabel("Focus")
rFocus:SetRelativeWidth(0.2)
rFocus:SetHeight(15)
local rSelf = AceGUI:Create("CheckBox")
rSelf:SetType("radio")
rSelf:SetValue(false)
rSelf:SetLabel("Self")
rSelf:SetRelativeWidth(0.15)
rSelf:SetHeight(15)
local rPet = AceGUI:Create("CheckBox")
rPet:SetType("radio")
rPet:SetValue(false)
rPet:SetLabel("Pet")
rPet:SetRelativeWidth(0.15)
rPet:SetHeight(15)
local rCustGroup = AceGUI:Create("SimpleGroup")
rCustGroup:SetLayout("Flow")
local rCustom = AceGUI:Create("CheckBox")
rCustom:SetType("radio")
rCustom:SetValue(false)
rCustom:SetLabel("Custom:")
rCustom:SetRelativeWidth(0.25)
rCustom:SetHeight(15)
local custBox = AceGUI:Create("EditBox")
custBox:SetPoint("LEFT",0,0)
custBox:SetDisabled(not rCustom:GetValue())
custBox:SetWidth(150)
rCustGroup:AddChildren(rCustom,custBox)
targGroup:AddChildren(rTarget,rFocus,rSelf,rPet,rCustGroup)
typeGroup:AddChildren(box,targLabel,targGroup)
elseif type == "Empty" then
label:SetText("\nAn Empty timer can act as a spacer between other timers.\n")
end
ddg:AddChildren(label,typeGroup)
end
Background: I've been using AceGUI to create an object config menu to call from a prototype, that is separate from the base addon's config menu. I decided to use AceGUI directly instead of AceConfigDialog because I wanted the added flexibility and I couldn't quite figure out how to call a ConfigDialog window up and still have it function properly when a derived object opens it.
Registering a new layout to use in a container worked like a charm, thanks! I didn't make it fully functional, so adding too many widgets to a container with that layout will have odd behavior, but it works fine for my purposes.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Question: How do I make the widgets go where I want them to? I'd like two buttons (in the code below, "save" and "cancel") to be in the bottom right of my dialog box. I've tried making dummy groups to try and trick the "Flow" layout into putting them there, but it isn't working for me. I've tried button:ClearAllPoints() and then button:SetPoint(...) but this sometimes fails (when giving it 5 arguments, like I've done elsewhere) or does nothing at all (when I give it 3 arguments).
Here's the relevant section of my code:
If you want to slog through the whole thing, it's here: http://pastey.net/129697
Background: I've been using AceGUI to create an object config menu to call from a prototype, that is separate from the base addon's config menu. I decided to use AceGUI directly instead of AceConfigDialog because I wanted the added flexibility and I couldn't quite figure out how to call a ConfigDialog window up and still have it function properly when a derived object opens it.
See also AceGUI-3.0.lua. The default flow and list layouts are in there.
If you use a container and the layout functions, that wont be easy to solve.