Zork your code is really cool but surely too much complex for a newbie programmer like me :-)
Slowly I have finished my alpha version of the addons, but I am plenty of questions. So I try to ask for finding more help.
I upload a picture which represent a ganklist. I'd like to click on a name, this set the text in the text input and then I can press del to delete it from the list or add a new name to it.
Now I'd like to ask.
1) in the frame I have created I have the button text that are "centered" ... I am trying to let them left justify but none of the methods I used till now seems to work.
2) Is possible to let the buttons to react to the OnClick event ? Something like:
button:SetScript("OnClick", function() ... bla bla
3) Is possible to have the scrollframe "bordered" like the input box below ?
4) How can I make a orizontal bar for divide the zones of a frame ?
The code is now:
Lua Code:
-- Configuration Panel -------------------------------------------------------------------------------------
local options = CreateFrame("Frame", ADDON.."Options", InterfaceOptionsFramePanelContainer)
options.name = GetAddOnMetadata(ADDON, "Title") or ADDON
InterfaceOptions_AddCategory(options)
local title = options:CreateFontString("$parentTitle", "ARTWORK", "GameFontNormalLarge")
title:SetPoint("TOPLEFT", 16, -16)
title:SetText(options.name)
options.title = title
local subtext = options:CreateFontString("$parentSubText", "ARTWORK", "GameFontHighlightSmall")
subtext:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
subtext:SetPoint("RIGHT", -32, 0)
subtext:SetHeight(32)
subtext:SetJustifyH("LEFT")
subtext:SetJustifyV("TOP")
subtext:SetText(GetAddOnMetadata(ADDON, "Notes"))
options.subtext = subtext
local enable = CreateFrame("CheckButton", "$parentEnable", options, "InterfaceOptionsCheckButtonTemplate")
enable:SetPoint("TOPLEFT", subtext, "BOTTOMLEFT", -2, -8)
enable.Text:SetText(ENABLE)
enable.tooltipText = "Enable monitoring"
enable:SetChecked(REMGANK_ENABLE);
enable:SetScript("OnClick", function(self)
if enable:GetChecked() then
REMGANK_ENABLE = 1
print(string_format("%s: is enabled", prgname))
frame_cleu:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
REMGANK_ENABLE = 0
print(string_format("%s: is disabled",prgname))
frame_cleu:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
end)
-- Add button
local RemGank_Add_Player_Button = CreateFrame("button","RemGank_Add_Player_Button", options, "UIPanelButtonTemplate")
RemGank_Add_Player_Button:SetHeight(25)
RemGank_Add_Player_Button:SetWidth(50)
RemGank_Add_Player_Button:SetPoint("BOTTOMRIGHT", options, "BOTTOMRIGHT", -12, 12)
RemGank_Add_Player_Button:SetText("Add")
RemGank_Add_Player_Button:SetScript("OnClick",
function()
end)
-- Del Button
local RemGank_Del_Player_Button = CreateFrame("button","RemGank_Del_Player_Button", options, "UIPanelButtonTemplate")
RemGank_Del_Player_Button:SetHeight(25)
RemGank_Del_Player_Button:SetWidth(50)
RemGank_Del_Player_Button:SetPoint("BOTTOMRIGHT", options, "BOTTOMRIGHT", -72, 12)
RemGank_Del_Player_Button:SetText("Del")
RemGank_Del_Player_Button:SetScript("OnClick",
function()
end)
-- Text Input
local RemGank_Input_eb2 = CreateFrame("EditBox","eb2",options,"InputBoxTemplate")
RemGank_Input_eb2:SetMaxLetters(15)
RemGank_Input_eb2:SetFont(framefontn,framefonth)
RemGank_Input_eb2:SetAutoFocus(disable)
RemGank_Input_eb2:SetSize(192, 24)
RemGank_Input_eb2:SetPoint("BOTTOMRIGHT", options, "BOTTOMRIGHT", -132, 12)
local scrollFrame = CreateFrame("ScrollFrame", "MyFirstNotReallyScrollFrame", options, "FauxScrollFrameTemplate")
scrollFrame:SetWidth(BUTTON_WIDTH * 3)
scrollFrame:SetHeight(NUM_BUTTONS * BUTTON_HEIGHT)
scrollFrame:SetPoint("BOTTOMRIGHT", options, "BOTTOMRIGHT", -38, 64)
scrollFrame:EnableMouse(true)
scrollFrame:SetScript("OnDragStart", function(self) self:StartMoving() end)
scrollFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
scrollFrame:Show()
scrollFrame:SetScript("OnVerticalScroll", function(self, offset)
FauxScrollFrame_OnVerticalScroll(self, offset, BUTTON_HEIGHT, RemGank_ListFrame_Update(self))
end)
for i = 1, NUM_BUTTONS do
local button = CreateFrame("Button", nil, scrollFrame:GetParent())
if i == 1 then
button:SetPoint("TOP", scrollFrame)
else
button:SetPoint("TOP", buttons[i - 1], "BOTTOM")
-- button:SetPoint("TOP", buttons[i - 1], "LEFT", 0, 0)
end
button:SetNormalFontObject("GameFontNormal")
button:SetSize(BUTTON_WIDTH, BUTTON_HEIGHT)
button:SetText(RemGankLS[i])
button:SetScript("OnClick", function()
RemGank_Input_eb2:SetText(RemGankLS[i])
end)
buttons[i] = button
end
-- Updating ?
print ("DEBUG: Force updating")
RemGank_ListFrame_Update(scrollFrame)
function options.refresh()
enable:SetChecked(REMGANK_ENABLE)
RemGank_ListFrame_Update(scrollFrame)
end
if LibStub and LibStub("LibAboutPanel", true) then
options.about = LibStub("LibAboutPanel").new(options.name, ADDON)
end
Thanks again to all for your attention