Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-01-15, 12:52 PM   #1
Basil2
An Aku'mai Servant
Join Date: Feb 2015
Posts: 30
Can I make options dialog by using code?

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).

Last edited by Basil2 : 04-01-15 at 01:40 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Can I make options dialog using code?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off