Looks like I didn't succeed =(
I added this to the code of the panel that I want to open:
Lua Code:
local category = Settings.RegisterCanvasLayoutCategory(panel, "MyAddonOptionsPanel")
Settings.RegisterAddOnCategory(category)
I also changed the button code on the minimap
Lua Code:
local addonName, addon = ...
-- Create the minimap icon
local addonName = "MyAddon"
local LDB = LibStub("LibDataBroker-1.1")
local minimapIcon = LibStub("LibDBIcon-1.0")
-- Create a data broker object for the addon
local dataBroker = LDB:NewDataObject(addonName, {
type = "data source",
icon = "Interface\\AddOns\\ZamestoTV_GoldFarm\\Icons\\goblin", -- Replace with your addon's icon path
OnClick = function(self, button)
if button == "LeftButton" then
local categoryID = MyAddonOptionsPanel:GetID() -- Replace with your addon's options panel ID
Settings.OpenToCategory(categoryID)
end
end,
})
-- Register the data broker with the minimap icon
minimapIcon:Register(addonName, dataBroker, {
hide = false,
minimapPos = 180, -- Set the position on the minimap (in degrees)
})
-- Add a function to set the category ID for opening
function addon:SetOptionsPanelCategory(categoryID)
MyAddonOptionsPanel:SetID(categoryID)
end
As a result, the button works without changes (using the example with the pictures above)