I need to create window with several checkboxes (like PowerAuras options dialog but simplier). I expected to do this using CreateFrame(), but the following code doesn't work at all:
Code:
function OpenSettingsFrame()
local f = RecommendOptionsFrame -- this frame is defined in xml file
f:Show()
CreateFeatureLine(f, RcmSettings.Riptide)
CreateFeatureLine(f, RcmSettings.Surge)
end
function CreateFeatureLine(parent, feature)
f = CreateFrame("FontString ", nil, parent)
f:Show()
f:SetText(feature.Name)
for k, v in pairs(feature.Values) do
CreateCheckbox(f, v, UseTypeNames[k])
end
end
function CreateCheckbox(parent, value, ttp)
b = CreateFrame("CheckButton", nil, parent)
b:Show()
b:SetChecked(value)
b.tooltip = ttp;
end
First of all, CreateFrame("FontString") fails - it writes "Unknown frame type 'FontString'". I am a bit surprised - I expected that every type of xml frame can be created via code.
Second, if I change "FontString" just to "Frame", the code generates no errors but doesn't work - checkboxes do not appear. At the same time, RecommendOptionsFrame is shown correctly (I see it on screen).
And third, I have questions
:
1. How to make frame with text using code?
2. Why checkboxes don't appear?
3. Which addon does create its GUI using code? (that I can inspect).