Thread Tools Display Modes
06/29/24, 04:06 AM   #1
tealke
Join Date: Mar 2023
Posts: 15
I have a problem with displaying the menu in TLC

Hello people
I wrote two codes here one contains TLC named TMA_Menu
and with the second one, I'm trying to get the content into it (the second file is called TMA_Settings), both codes are attached below. The problem is that the TMA_Menu menu is displayed correctly, but the content from the TMA_Setting is no longer filled in, and I really don't know what to do with it, could someone give me some advice? Thank you very much to everyone who can give me advice

TMA_Menu:
Code:
local TMA_Menu = {}
local wm = WINDOW_MANAGER

-- Utility Functions
local function CreateControl(parent, controlType, controlName)
    if not wm then
        d("Error: WINDOW_MANAGER is not available.")
        return nil
    end
    parent = parent or GuiRoot
    return wm:CreateControl(controlName or nil, parent, controlType)
end

local function InitializeTooltip(control, text)
    control:SetHandler("OnMouseEnter", function(self)
        InitializeTooltip(InformationTooltip, self, BOTTOM, 0, 0)
        SetTooltipText(InformationTooltip, text)
    end)
    control:SetHandler("OnMouseExit", function(self)
        ClearTooltip(InformationTooltip)
    end)
end

-- Panel Functions
function TMA_Menu.CreateSettingWindows()
    local wm = WINDOW_MANAGER
    if not wm then
        d("Error: WINDOW_MANAGER is nil")
        return
    end
    
    local windowName = "TMA_Menu"
    local dark = wm:CreateTopLevelWindow(windowName)
    dark:SetDimensions(1010, 914)
    dark:SetHidden(true)

    ZO_ReanchorControlForLeftSidePanel(dark)

    local bgLeft = wm:CreateControl("$(parent)BackgroundLeft", dark, CT_TEXTURE)
    bgLeft:SetTexture("EsoUI/Art/Miscellaneous/centerscreen_left.dds")
    bgLeft:SetDimensions(1024, 1024)
    bgLeft:SetAnchor(TOPLEFT, nil, TOPLEFT)
    bgLeft:SetDrawLayer(DL_BACKGROUND)
    bgLeft:SetExcludeFromResizeToFitExtents(true)

    local bgRight = wm:CreateControl("$(parent)BackgroundRight", dark, CT_TEXTURE)
    bgRight:SetTexture("EsoUI/Art/Miscellaneous/centerscreen_right.dds")
    bgRight:SetDimensions(64, 1024)
    bgRight:SetAnchor(TOPLEFT, bgLeft, TOPRIGHT)
    bgRight:SetDrawLayer(DL_BACKGROUND)
    bgRight:SetExcludeFromResizeToFitExtents(true)

    local underlayLeft = wm:CreateControl("$(parent)UnderlayLeft", dark, CT_TEXTURE)
    underlayLeft:SetTexture("EsoUI/Art/Miscellaneous/centerscreen_indexArea_left.dds")
    underlayLeft:SetDimensions(256, 1024)
    underlayLeft:SetAnchor(TOPLEFT, bgLeft, TOPLEFT)
    underlayLeft:SetDrawLayer(DL_BACKGROUND)
    underlayLeft:SetExcludeFromResizeToFitExtents(true)

    local underlayRight = wm:CreateControl("$(parent)UnderlayRight", dark, CT_TEXTURE)
    underlayRight:SetTexture("EsoUI/Art/Miscellaneous/centerscreen_indexArea_right.dds")
    underlayRight:SetDimensions(128, 1024)
    underlayRight:SetAnchor(TOPLEFT, underlayLeft, TOPRIGHT)
    underlayRight:SetDrawLayer(DL_BACKGROUND)
    underlayRight:SetExcludeFromResizeToFitExtents(true)

    local title = wm:CreateControl("$(parent)Title", dark, CT_LABEL)
    title:SetAnchor(TOPLEFT, nil, TOPLEFT, 65, 70)
    title:SetText(TMA.NameS)
    title:SetFont("ZoFontWinH1")
    title:SetModifyTextType(TEXT_MODIFY_TYPE_UPPERCASE)

    local author = wm:CreateControl("$(parent)Author", dark, CT_LABEL)
    author:SetAnchor(TOPRIGHT, title, TOPLEFT, 770, 15)
    author:SetText(" Author: " .. TMA.Autor .. " Version: " .. TMA.Version .. " ")
    author:SetFont("ZoFontWinT2")

    local divider = wm:CreateControlFromVirtual("$(parent)Divider", dark, "ZO_Options_Divider")
    divider:SetAnchor(TOPLEFT, nil, TOPLEFT, 65, 108)

    local addonList = wm:CreateControlFromVirtual("$(parent)AddonList", dark, "ZO_ScrollList")
    addonList:SetAnchor(TOPLEFT, nil, TOPLEFT, 65, 160)
    addonList:SetDimensions(285, 665)

    local panelContainer = wm:CreateControl("$(parent)PanelContainer", dark, CT_CONTROL)
    panelContainer:SetAnchor(TOPLEFT, nil, TOPLEFT, 365, 120)
    panelContainer:SetDimensions(645, 675)

    local scene = ZO_FadeSceneFragment:New(dark)
    local leftFragment = ZO_FadeSceneFragment:New(bgLeft)
    local rightFragment = ZO_FadeSceneFragment:New(bgRight)

    scene:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_FRAGMENT_SHOWING then
            PushActionLayerByName("OptionsWindow")
        elseif newState == SCENE_FRAGMENT_HIDDEN then
            RemoveActionLayerByName("OptionsWindow")
        end
    end)

    leftFragment:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_FRAGMENT_SHOWING then
            PushActionLayerByName("OptionsWindow")
        elseif newState == SCENE_FRAGMENT_HIDDEN then
            RemoveActionLayerByName("OptionsWindow")
        end
    end)

    rightFragment:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_FRAGMENT_SHOWING then
            PushActionLayerByName("OptionsWindow")
        elseif newState == SCENE_FRAGMENT_HIDDEN then
            RemoveActionLayerByName("OptionsWindow")
        end
    end)
         
     return dark, scene, leftFragment, rightFragment
end

function TMA_Menu:CreateSettingsWindow(panelName)
    local panelData = self.panelData[panelName]
    if not panelData then
        d("Error: No panel data found for " .. panelName)
        return
    end

    local control = CreateControl(panelName .. "_SettingsWindow", GuiRoot, CT_CONTROL)
    if not control then
        d("Error: Unable to create control for " .. panelName)
        return
    end

    control:SetDimensions(600, 400)
    control:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
    control:SetHidden(true)

    local bg = CreateControlFromVirtual("$parentBG", control, "ZO_Options_Background")
    bg:SetAnchorFill(control)

    local header = CreateControl(control:GetName() .. "_Header", control, CT_LABEL)
    header:SetFont("ZoFontHeader")
    header:SetText(panelData.displayName)
    header:SetAnchor(TOP, control, TOP, 0, 10)

    local version = CreateControl(control:GetName() .. "_Version", control, CT_LABEL)
    version:SetFont("ZoFontWinH3")
    version:SetText("Version: " .. panelData.version)
    version:SetAnchor(TOP, header, BOTTOM, 0, 5)

    local author = CreateControl(control:GetName() .. "_Author", control, CT_LABEL)
    author:SetFont("ZoFontWinH3")
    author:SetText("Author: " .. panelData.author)
    author:SetAnchor(TOP, version, BOTTOM, 0, 0)

    self.panelControl = control
    return control
end


function TMA_Menu:RegisterAddonPanel(panelName, panelData)
    if not self.panelData then
        self.panelData = {}
    end
    self.panelData[panelName] = panelData
end

function TMA_Menu:RegisterOptionControls(panelName, optionsTable)
    local panel = self.panelData[panelName]
    if not panel then
        d("Error: No panel data found for " .. panelName)
        return
    end

    local parent = self.panelControl
    if not parent then
        d("Error: Panel control not found for " .. panelName)
        return
    end

    for index, optionData in ipairs(optionsTable) do
        local optionControl = self["Create" .. optionData.type](self, parent, optionData)
        if optionControl then
            optionControl:SetAnchor(TOPLEFT, parent, TOPLEFT, 20, 50 + 40 * index)
        else
            d("Error: Unable to create option control for " .. optionData.type)
        end
    end

    local control = self.panelControl
    for _, option in ipairs(optionsTable) do
        local optionControl = CreateControlFromVirtual("$parent" .. option.type, control, option.type)
        optionControl:SetAnchor(TOP, control, TOP, 0, 100 * _)
        optionControl:SetText(option.name)
    end
end

function TMA_Menu:HideSettingsWindow()
    if self.panelControl and not self.panelControl:IsHidden() then
        self.panelControl:SetHidden(false)
    end
end

-- Control Creation Functions (continued)
function TMA_Menu:CreateDescription(parent, data)
    local control = CreateControl(parent, CT_LABEL)
    control:SetFont("ZoFontWinH3")
    control:SetText(data.text)
    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    control:SetDimensions(parent:GetWidth() - 20, 30)
    InitializeTooltip(control, data.tooltip)
    return control
end

function TMA_Menu:CreateDropdown(parent, data)
    local control = CreateControlFromVirtual("$parentDropdown", parent, "ZO_ComboBox")
    local dropdown = ZO_ComboBox_ObjectFromContainer(control)
    dropdown:SetSortsItems(false)
    dropdown:ClearItems()

    for _, choice in ipairs(data.choices) do
        local entry = dropdown:CreateItemEntry(choice, function() data.setFunc(choice) end)
        dropdown:AddItem(entry)
    end

    dropdown:SelectItemByIndex(1)
    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    InitializeTooltip(control, data.tooltip)
    return control
end

function TMA_Menu:CreateSlider(parent, data)
    local control = CreateControlFromVirtual("$parentSlider", parent, "ZO_DefaultSlider")
    control:SetMinMax(data.min, data.max)
    control:SetValueStep(data.step)
    control:SetValue(data.getFunc())

    control:SetHandler("OnValueChanged", function(_, value, eventReason)
        if eventReason == EVENT_REASON_SOFTWARE then return end
        data.setFunc(value)
    end)

    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    InitializeTooltip(control, data.tooltip)
    return control
end

function TMA_Menu:CreateButton(parent, data)
    local control = CreateControlFromVirtual("$parentButton", parent, "ZO_DefaultButton")
    control:SetText(data.name)
    control:SetHandler("OnClicked", data.func)
    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    InitializeTooltip(control, data.tooltip)
    return control
end

function TMA_Menu:CreateCheckbox(parent, data)
    local control = CreateControl(parent, CT_CHECKBOX)
    control:SetText(data.name)
    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    control:SetDimensions(200, 30)
    control:SetHandler("OnClicked", function()
        data.setFunc(not data.getFunc())
    end)
    InitializeTooltip(control, data.tooltip)
    return control
end

function TMA_Menu:CreateColorPicker(parent, data)
    local control = CreateControl(parent, CT_COLORSELECT)
    control:SetColor(data.getFunc())
    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    control:SetDimensions(50, 50)
    control:SetHandler("OnColorSelected", function(_, r, g, b, a)
        data.setFunc(r, g, b, a)
    end)
    InitializeTooltip(control, data.tooltip)
    return control
end

function TMA_Menu:CreateEditBox(parent, data)
    local control = CreateControl(parent, CT_EDITBOX)
    control:SetText(data.getFunc())
    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    control:SetDimensions(parent:GetWidth() - 20, 30)
    control:SetHandler("OnTextChanged", function(_, text)
        data.setFunc(text)
    end)
    InitializeTooltip(control, data.tooltip)
    return control
end

function TMA_Menu:CreateSubmenu(parent, data)
    local control = CreateControl(parent, CT_CONTROL)
    control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
    control:SetDimensions(parent:GetWidth() - 20, 200)

    local label = CreateControl(control, CT_LABEL)
    label:SetFont("ZoFontWinH2")
    label:SetText(data.name)
    label:SetAnchor(TOPLEFT, control, TOPLEFT, 10, 10)
    
    local submenuControl = CreateControl(control, CT_CONTROL)
    submenuControl:SetAnchor(TOPLEFT, label, BOTTOMLEFT, 0, 10)
    submenuControl:SetDimensions(parent:GetWidth() - 40, 180)

    for _, subData in ipairs(data.controls) do
        local subControl = self["Create" .. subData.type](self, submenuControl, subData)
        if subControl then
            subControl:SetAnchor(TOPLEFT, submenuControl, TOPLEFT, 0, 40 * _)
        else
            d("Error: Unable to create submenu control for " .. subData.type)
        end
    end

    return control
end

-- Register Settings
function TMA_Menu.RegisterSettings()
    EVENT_MANAGER:RegisterForEvent("TMA_Menu", EVENT_PLAYER_ACTIVATED, function()
        local dark, scene, leftFragment, rightFragment = TMA_Menu.CreateSettingWindows()
        settingsWindow = dark
        local data = {
            id = "TMAMenu",
            name = TMA.DisplayName,
            longname = TMA.NameS,
            callback = function()
                SCENE_MANAGER:AddFragment(scene)
                SCENE_MANAGER:AddFragment(leftFragment)
                SCENE_MANAGER:AddFragment(rightFragment)
            end,
            unselectedCallback = function()
                SCENE_MANAGER:RemoveFragment(scene)
                SCENE_MANAGER:RemoveFragment(leftFragment)
                SCENE_MANAGER:RemoveFragment(rightFragment)
            end,
        }

        TMA_Menu:RegisterAddonPanel("TMAMenu", data)
        ZO_GameMenu_AddSettingPanel(data)
    end)
end

-- Register settings when the addon is loaded
EVENT_MANAGER:RegisterForEvent("TMA_Menu_Load", EVENT_ADD_ON_LOADED, function(event, addonName)
    if addonName == "TealkeMultiAddons" then
        TMA_Menu.RegisterSettings()
        TMA_Menu:HideSettingsWindow()
    end
end)

-- Register TMA_Menu with the global environment or addon framework
-- Return TMA_Menu table to be assigned to global _G
_G["TMA_Menu"] = TMA_Menu
return TMA_Menu
TMA_Settings:
Code:
local TMA_Menu = _G["TMA_Menu"]
if not TMA_Menu then return end

-- Sample panel data and option controls
local function AddMenuContents()
    -- Sample panel data
    local panelData = {
        panelName = "TealkeMultiAddonsPanel",
        displayName = "Tealke Multi Addons",
        version = "1.0",
        author = "Tealke",
    }

    -- Register the panel
    TMA_Menu:RegisterAddonPanel("TealkeMultiAddonsPanel", panelData)

    -- Sample option controls
    local optionsTable = {
        {
            type = "Description",
            text = "This is a description for the Tealke Multi Addons panel.",
            tooltip = "This is a tooltip for the description."
        },
        {
            type = "Dropdown",
            name = "Select an Option",
            choices = {"Option 1", "Option 2", "Option 3"},
            tooltip = "Select an option from the dropdown.",
            setFunc = function(value) d("Dropdown selected: " .. value) end,
        },
        {
            type = "Slider",
            name = "Adjust the Slider",
            min = 0,
            max = 100,
            step = 1,
            getFunc = function() return 50 end,
            setFunc = function(value) d("Slider value: " .. value) end,
            tooltip = "Adjust the slider between 0 and 100.",
        },
        {
            type = "Button",
            name = "Click Me",
            func = function() d("Button clicked") end,
            tooltip = "Click this button.",
        },
        {
            type = "Checkbox",
            name = "Enable Feature",
            getFunc = function() return true end,
            setFunc = function(value) d("Checkbox state: " .. tostring(value)) end,
            tooltip = "Check or uncheck this box.",
        },
        {
            type = "ColorPicker",
            name = "Pick a Color",
            getFunc = function() return 1, 0, 0, 1 end,
            setFunc = function(r, g, b, a) d("Color selected: ", r, g, b, a) end,
            tooltip = "Pick a color.",
        },
        {
            type = "EditBox",
            name = "Enter Text",
            getFunc = function() return "Sample text" end,
            setFunc = function(text) d("EditBox text: " .. text) end,
            tooltip = "Enter some text.",
        },
        {
            type = "Submenu",
            name = "Submenu",
            controls = {
                {
                    type = "Checkbox",
                    name = "Submenu Checkbox",
                    getFunc = function() return false end,
                    setFunc = function(value) d("Submenu checkbox state: " .. tostring(value)) end,
                    tooltip = "This is a checkbox in a submenu.",
                },
            },
        },
    }

    -- Create the settings window and register option controls
    TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel_SettingsWindow")
    TMA_Menu:RegisterOptionControls("TealkeMultiAddonsPanel", optionsTable)
end

-- Register the settings and add menu contents on addon load
EVENT_MANAGER:RegisterForEvent("TMA_Menu_Load", EVENT_ADD_ON_LOADED, function(event, addonName)
    if addonName == "TealkeMultiAddons" then
        TMA_Menu.RegisterSettings()
        TMA_Menu:HideSettingsWindow()
        AddMenuContents()
    end
end)

-- Return TMA_Menu with the global environment or addon framework
return TMA_Menu
  Reply With Quote
06/29/24, 04:42 PM   #2
Calamath
AddOn Author - Click to view addons
Join Date: Aug 2019
Posts: 38
I did indeed read your thread, but I'm not a programming concierge.
I'm sure you too are aware of a popular add-on called LibAddonMenu.
I'm not sure why you're trying to scratch something similar to it, but if you're building something with reference to zo_options for learning purposes, you'll have to read the code more carefully.
  Reply With Quote
06/30/24, 01:08 AM   #3
tealke
Join Date: Mar 2023
Posts: 15
Yes, I know LAM2, but for what I create, I don't find it very useful, so I'm trying to make my own add-on. I'm not an extra programmer and I'm just getting started with lua, I know I'll have some trivial error or I'm missing something important, that's why I'm turning to this forum because I don't know what to do anymore
  Reply With Quote
06/30/24, 04:33 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,088
Could you please attach the total lua and txt files so we can test your addon in total and see what is not working.
Any error messages if you use LiDebugLogger and DebugLogViewer?
Where exactly is your settings menu to show and how to show it?
Please provide steps how to reproduce, thanks.

Btw views do not tell anything about if someone can help or not, especially not on weekends.
If you fear someone would take your code (which is very unusual as LAM2 works and is used for settings menus) you must add a license that prohibts that. But your code actually looks very similar to LAM2, even function names and tables are the same! So before raising intellectual property incidents I'd at first add the info you looked at LAM2 to build your addon...

Last edited by Baertram : 06/30/24 at 04:36 AM.
  Reply With Quote
06/30/24, 04:48 AM   #5
tealke
Join Date: Mar 2023
Posts: 15
I am also attaching the other two files that I have, the fact that it resembles LAM2 is possible because I was a little inspired, but I tried to edit it, and I have to admit that I used chatGDP4 for the incoming code because I was already desperate and he probably rewrote it for me that it is probably more similar to LAM2, as I wrote above with LUA I am still learning.

I haven't put the license here yet... and I'll write it down when it somehow works, and I'm not afraid that someone would steal it it was meant more like a bad joke, unfortunately that's my nature, for which I apologize

TealkeMultiAddons.txt:
Code:
; DISCLAIMER:
;
; This Add-on is not created by, affiliated with or sponsored by ZeniMax
; Media Inc. or its affiliates. The Elder Scrolls® and related logos are
; registered trademarks or trademarks of ZeniMax Media Inc. in the United
; States and/or other countries. All rights reserved.
;
; You can read the full terms at:
; https://account.elderscrollsonline.com/add-on-terms

; Author: @tealke on EU-Server!

## Title: |c00FFFFTealke Multi|r|c00FF00AddOns|r
## APIVersion: 101042
## AddOnVersion: 1.000
## SavedVariables: TMA_VARS TMA_REPORTS 
## Author: |c00FFFF@tealke|r|cC0C0C0 [EU]|r
## Description: Advanced guild settings (GM, member), chat settings, personal notes in the guild and with friends and much more.

lang/en.lua           
lang/$(language).lua

TMA_Vars.lua
TMA_Menu.lua
TMA_Settings.lua
TMA_Vars.lua:
Code:
TMA = {
    DisplayName		="|c00FFFFTealke Multi|r|c00FF00AddOns|r",
	ShortNam		="|c00FFFFTealke MA|r",
	NameS              ="|c00FFFFTealke Multi|r|c00FF00AddOns|r Settings",
	Autor                ="|c00FFFF@tealke|r|cC0C0C0 [EU]|r",
        Version	        ="1.000",
	Menu                ={},
	Settings            ={},

	defaults={
		module1         =true,
		module2         =true,
	},
	}
this is all the code I have written for it so far

p.s.: I'd rather remove the message so it doesn't cause negative impressions

Last edited by tealke : 06/30/24 at 05:00 AM.
  Reply With Quote
06/30/24, 05:11 AM   #6
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
Could you please attach the total lua and txt files so we can test your addon in total and see what is not working.
Any error messages if you use LiDebugLogger and DebugLogViewer?
Where exactly is your settings menu to show and how to show it?
Please provide steps how to reproduce, thanks.

Btw views do not tell anything about if someone can help or not, especially not on weekends.
If you fear someone would take your code (which is very unusual as LAM2 works and is used for settings menus) you must add a license that prohibts that. But your code actually looks very similar to LAM2, even function names and tables are the same! So before raising intellectual property incidents I'd at first add the info you looked at LAM2 to build your addon...
you yourself advised me to look at LAM2 that I can use some function from it, it's a smaller thread on this forum, if it's a problem or something needs to be added to the comment or the license, please write me what to make it right
  Reply With Quote
06/30/24, 09:59 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,088
Originally Posted by tealke View Post
you yourself advised me to look at LAM2 that I can use some function from it, it's a smaller thread on this forum, if it's a problem or something needs to be added to the comment or the license, please write me what to make it right

Yes, that's totally fine. But if you do so you cannnot add your own license with other terms in the end!
You need to use the existing lam license, provide proper credit and tell that you did use LAM as a base (which is very obvious).

You cannot just spy and use code and then say it was yours because you changed it, that's not how intelectual property works
So whatever you do here, you cannot tell others they get reported for using your code if you yourself did use other's code, even as an inspiration, without respecting the licensing of LAM, following it and providing the same license in your addon then.
At best read the license and act how it asks you to do. I do neither know all details from the scratch, but I'm pretty sure it says "If you use the code include a proper credit and the license itself".

If you do not want to do that you need to totally recode all that LAM did already by your own, not using any functions or code of it!
But even then we would know you did get the inspiration and code ideas from it and you at least should credit it as inspiration and source.

All in all I did not want to talk about that licensing here but as you wrote in your 2nd post that someone stealing "your code" would get reported I had to mention that Even if that was a bad joke, I cannot laugh about "reporting others". I noticed it was meant kind of ironic, but it was a bit too much imo.
Hope you get the point, thanks.


As I find time I'll try your files and see i I can find any error > btw you can simply attach the txt lua files here as a zip file too!
zip the folder and attach it, is way easier and less error prone then having to manually copy file contents together.

Edit
You do twice this - Once in TMA menu once in TMA settings. Why?
Just do EVENT_ADD_ON_LOADED that once! Especially with the same name or it overwrites each other, the later one called wins most probably.
As your txt file says the order to load the lua files is menu, then settings the settings most probably wins
I'd remove it in the tma_menu.lua file

-- Register the settings and add menu contents on addon load
EVENT_MANAGER:RegisterForEvent("TMA_Menu_Load", EVENT_ADD_ON_LOADED, function(event, addonName)
if addonName == "TealkeMultiAddons" then
TMA_Menu.RegisterSettings()
TMA_Menu:HideSettingsWindow()
AddMenuContents()
end
end)

The return at the bottom of each lua file is not needed!
You got the global variable TMA alread so either add TMA.Menu = TMA_Menu or just use TMA_Menu which was created as global here
_G["TMA_Menu"] = TMA_Menu

Your addon's folder and txt files MUST be "TealkeMultiAddons" as you are checking in EVENT_ADD_ON_LOADED if addonName == "TealkeMultiAddons" then

Is that the case?

Last edited by Baertram : 06/30/24 at 10:13 AM.
  Reply With Quote
06/30/24, 10:21 AM   #8
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
Yes, that's totally fine. But if you do so you cannnot add your own license with other terms in the end!
You need to use the existing lam license, provide proper credit and tell that you did use LAM as a base (which is very obvious).

You cannot just spy and use code and then say it was yours because you changed it, that's not how intelectual property works
So whatever you do here, you cannot tell others they get reported for using your code if you yourself did use other's code, even as an inspiration, without respecting the licensing of LAM, following it and providing the same license in your addon then.
At best read the license and act how it asks you to do. I do neither know all details from the scratch, but I'm pretty sure it says "If you use the code include a proper credit and the license itself".

If you do not want to do that you need to totally recode all that LAM did already by your own, not using any functions or code of it!
But even then we would know you did get the inspiration and code ideas from it and you at least should credit it as inspiration and source.

All in all I did not want to talk about that licensing here but as you wrote in your 2nd post that someone stealing "your code" would get reported I had to mention that Even if that was a bad joke, I cannot laugh about "reporting others". I noticed it was meant kind of ironic, but it was a bit too much imo.
Hope you get the point, thanks.


As I find time I'll try your files and see i I can find any error > btw you can simply attach the txt lua files here as a zip file too!
zip the folder and attach it, is way easier and less error prone then having to manually copy file contents together.
thank you for the information...I will definitely write the license in such a way that it will be mentioned that I was inspired by LAM and I will also mention that the code was changed...and I'm sorry...I'd rather delete the post than to cause negative feelings. ..and I understand your posts and why you write them, he should probably work on the interpretation of his post so that it doesn't sound the way I would like it to sound....and thank you for looking at what I wrote and trying to find a mistake in it, I I really don't know how to deal with it anymore and I would appreciate any help... I probably wouldn't deal with the license and intellectual property any further because I know you're right
  Reply With Quote
06/30/24, 10:21 AM   #9
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,088
Try this folder, not tested ingame but changed a few things and added comments there.
As I do not know (you did not answer that) how you expect what to show where and when, you need to test that yourself please.

Or describe, with simple steps, what to do with your addon ingame where, when and what you expect it to show then where and how. Thanks
Attached Files
File Type: zip TealkeMultiAddons_Baertram_try1.zip (9.0 KB, 4 views)
  Reply With Quote
06/30/24, 10:28 AM   #10
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
Try this folder, not tested ingame but changed a few things and added comments there.
As I do not know (you did not answer that) how you expect what to show where and when, you need to test that yourself please.

Or describe, with simple steps, what to do with your addon ingame where, when and what you expect it to show then where and how. Thanks
thanks i will look into it and try it out

I expect that the TMA_Settings file will be displayed in the TMA_Menu when a person opens the created item in the game settings... there will be other modules in the TMA_Settings that will appear after activation (with the toggle button or by ticking) again in the TLC TMA_menu


I'm sorry if I'm writing in an unintelligible way, I'm already drunk
  Reply With Quote
06/30/24, 10:41 AM   #11
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
Try this folder, not tested ingame but changed a few things and added comments there.
As I do not know (you did not answer that) how you expect what to show where and when, you need to test that yourself please.

Or describe, with simple steps, what to do with your addon ingame where, when and what you expect it to show then where and how. Thanks
I'm running into the same problem, which I don't know what causes it... I just see TLC without the content from TMA_Settings, see the attached screen which is from your zip file

I'm sending a screenshot from the game...only as a link, I can't even insert a picture : https://ctrlv.cz/sZWw
  Reply With Quote
06/30/24, 11:57 AM   #12
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,088
Originally Posted by tealke View Post
I'm sorry if I'm writing in an unintelligible way, I'm already drunk
Not the circumstancs to write in forums then, maybe do it the next day.

If you want to insert a picture you need to have a linkto a picture and not to a website where teh picture is shown.
You can use the [ i m g] url to image file here [/ i m g] tags (without space) then.

I'm running into the same problem, which I don't know what causes it... I just see TLC without the content from TMA_Settings, see the attached screen which is from your zip file
If something does not show it ost probably was not created (function not called properly) or it was created but not anchored or control:SetHidden(false) was missing so it's still hidden.

I recommand you use a tool like merTorchbug to inspect your controls ingame /tb TMU_Menu for example to see what happens, what current state (hidden) it got.
You can even use an addon Control Outlines to add visible frames/borders around the controls so you see where they are and how big they are in your UI.

I'd start to add d("got here!") debug messages in your code and use LibDbeugLogger + DebugLogViewer igame to see how far your code get's executed. We do the same to find out why something is not loaded, or only patcially.

Last edited by Baertram : 06/30/24 at 12:02 PM.
  Reply With Quote
06/30/24, 04:43 PM   #13
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,088
As I said, use LibDebugLogger and DebugLogViewer and then you see what is happening:


Happens in function TMA_Menu:CreateSettingsWindow(panelName)
called from local function AddMenuContents
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel_SettingsWindow")

The problem seems to be that TMA_Menu is your TLC now because you overrit it here:
local windowName = "TMA_Menu"
local dark = wm:CreateTopLevelWindow(windowName)


If you create a control with the same name as your table TMA_Menu it won't properly work.
Create the TLC control with some name like TMA_Menu_TLC e.g for the start:
local windowName = "TMA_Menu_TLC"

And then fix the code so the corerct TLC control is used.
After that a least the TMA_Menu global looks good again:



But your panelData subtable still only contains these 2:


So I gues this is a wrong used name?
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel_SettingsWindow")

And should be
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel")
instead?

Only thing is that after that last change my ESO client crashes.
Not sure why though. Maybe because your checkbox function is wrong:

Lua Code:
  1. function TMA_Menu:CreateCheckbox(parent, data)
  2.     local control = CreateControl(parent, CT_CHECKBOX)
  3.     control:SetText(data.name)
  4.     control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
  5.     control:SetDimensions(200, 30)
  6.     control:SetHandler("OnClicked", function()
  7.         data.setFunc(not data.getFunc())
  8.     end)
  9.     InitializeTooltip(control, data.tooltip)
  10.     return control
  11. end

CT_CHECKBOX does not exist

A checkbox control by ZOs needs to use the XML template ZO_CheckButton, it's not that easy to create.
You can use CreateControlFromVitual function and pass in the template "ZO_CheckButton" to do so.

For the start remove the checkbuttons from your options panel to test if those are the culprit

Last edited by Baertram : 06/30/24 at 05:02 PM.
  Reply With Quote
Yesterday, 06:45 AM   #14
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
Not the circumstancs to write in forums then, maybe do it the next day.

If you want to insert a picture you need to have a linkto a picture and not to a website where teh picture is shown.
You can use the [ i m g] url to image file here [/ i m g] tags (without space) then.


If something does not show it ost probably was not created (function not called properly) or it was created but not anchored or control:SetHidden(false) was missing so it's still hidden.

I recommand you use a tool like merTorchbug to inspect your controls ingame /tb TMU_Menu for example to see what happens, what current state (hidden) it got.
You can even use an addon Control Outlines to add visible frames/borders around the controls so you see where they are and how big they are in your UI.

I'd start to add d("got here!") debug messages in your code and use LibDbeugLogger + DebugLogViewer igame to see how far your code get's executed. We do the same to find out why something is not loaded, or only patcially.
thank you for the recommendation of debugging tools, I covered everything, I already had some
  Reply With Quote
Yesterday, 06:49 AM   #15
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
As I said, use LibDebugLogger and DebugLogViewer and then you see what is happening:


Happens in function TMA_Menu:CreateSettingsWindow(panelName)
called from local function AddMenuContents
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel_SettingsWindow")

The problem seems to be that TMA_Menu is your TLC now because you overrit it here:
local windowName = "TMA_Menu"
local dark = wm:CreateTopLevelWindow(windowName)


If you create a control with the same name as your table TMA_Menu it won't properly work.
Create the TLC control with some name like TMA_Menu_TLC e.g for the start:
local windowName = "TMA_Menu_TLC"

And then fix the code so the corerct TLC control is used.
After that a least the TMA_Menu global looks good again:



But your panelData subtable still only contains these 2:


So I gues this is a wrong used name?
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel_SettingsWindow")

And should be
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel")
instead?

Only thing is that after that last change my ESO client crashes.
Not sure why though. Maybe because your checkbox function is wrong:

Lua Code:
  1. function TMA_Menu:CreateCheckbox(parent, data)
  2.     local control = CreateControl(parent, CT_CHECKBOX)
  3.     control:SetText(data.name)
  4.     control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
  5.     control:SetDimensions(200, 30)
  6.     control:SetHandler("OnClicked", function()
  7.         data.setFunc(not data.getFunc())
  8.     end)
  9.     InitializeTooltip(control, data.tooltip)
  10.     return control
  11. end

CT_CHECKBOX does not exist

A checkbox control by ZOs needs to use the XML template ZO_CheckButton, it's not that easy to create.
You can use CreateControlFromVitual function and pass in the template "ZO_CheckButton" to do so.

For the start remove the checkbuttons from your options panel to test if those are the culprit
thanks for the advice, I'll try to fix it as you write, and I'll test it in the game when the servers are on, they're having maintenance there at the moment and I'll let you know if I don't know what to do again
  Reply With Quote
Yesterday, 11:15 AM   #16
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
As I said, use LibDebugLogger and DebugLogViewer and then you see what is happening:


Happens in function TMA_Menu:CreateSettingsWindow(panelName)
called from local function AddMenuContents
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel_SettingsWindow")

The problem seems to be that TMA_Menu is your TLC now because you overrit it here:
local windowName = "TMA_Menu"
local dark = wm:CreateTopLevelWindow(windowName)


If you create a control with the same name as your table TMA_Menu it won't properly work.
Create the TLC control with some name like TMA_Menu_TLC e.g for the start:
local windowName = "TMA_Menu_TLC"

And then fix the code so the corerct TLC control is used.
After that a least the TMA_Menu global looks good again:



But your panelData subtable still only contains these 2:


So I gues this is a wrong used name?
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel_SettingsWindow")

And should be
TMA_Menu:CreateSettingsWindow("TealkeMultiAddonsPanel")
instead?

Only thing is that after that last change my ESO client crashes.
Not sure why though. Maybe because your checkbox function is wrong:

Lua Code:
  1. function TMA_Menu:CreateCheckbox(parent, data)
  2.     local control = CreateControl(parent, CT_CHECKBOX)
  3.     control:SetText(data.name)
  4.     control:SetAnchor(TOPLEFT, parent, TOPLEFT, 10, 10)
  5.     control:SetDimensions(200, 30)
  6.     control:SetHandler("OnClicked", function()
  7.         data.setFunc(not data.getFunc())
  8.     end)
  9.     InitializeTooltip(control, data.tooltip)
  10.     return control
  11. end

CT_CHECKBOX does not exist

A checkbox control by ZOs needs to use the XML template ZO_CheckButton, it's not that easy to create.
You can use CreateControlFromVitual function and pass in the template "ZO_CheckButton" to do so.

For the start remove the checkbuttons from your options panel to test if those are the culprit
so i tried all options, i modified my addon according to your instructions but the game either crashes or still nothing shows up...seriously i don't know what i'm doing wrong or where the error could be, do you have any idea yet?
  Reply With Quote
Yesterday, 11:23 AM   #17
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,088
No, sorry.
I'd go on removing ALL controls added to the settings panel you create there first, to see if that carshes already.
If not, just add 1 option, and so on.

Got no idea here except that it must have to do with how you do things there.
Maybe you got duplicate names elsewhere which interfer each other. Maybe it's an endless loop (but that usually does not crash the client directly).

I actually cannot invest my time to check why it crashes, maybe someone else got an idea.
  Reply With Quote
Yesterday, 12:29 PM   #18
tealke
Join Date: Mar 2023
Posts: 15
Originally Posted by Baertram View Post
No, sorry.
I'd go on removing ALL controls added to the settings panel you create there first, to see if that carshes already.
If not, just add 1 option, and so on.

Got no idea here except that it must have to do with how you do things there.
Maybe you got duplicate names elsewhere which interfer each other. Maybe it's an endless loop (but that usually does not crash the client directly).

I actually cannot invest my time to check why it crashes, maybe someone else got an idea.
it doesn't matter, thanks for the advice... maybe someone else will think of something... or I'll figure it out myself in time

game crashes only when changing local windowName = "TMA_Menu" to local windowName = "TMA_Menu_TLC"

but thanks for the advice anyway
  Reply With Quote
Yesterday, 01:53 PM   #19
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,088
Did you check your code where the TLC you created there was else used then?
I only changed the name but did you assign that control to a variable or did you try to acess it via TMA_Menu afterwards again -> Which would be false as it exists under TMA_Menu_TLC now!

That's what I meant with my sentence
And then fix the code so the corerct TLC control is used.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » I have a problem with displaying the menu in TLC


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