After update to r16 because of Update 5, LAM doesn't properly select nodes in game menu tree when you open settings menu from slash command. Here is my (unfinished) solution:
Lua Code:
--METHOD: OPEN TO ADDON PANEL--
--opens to a specific addon's option panel
--Usage:
-- panel = userdata; the panel returned by the :RegisterOptionsPanel method
local locSettings = GetString(SI_GAME_MENU_SETTINGS)
function lam:OpenToPanel(panel)
SCENE_MANAGER:Show("gameMenuInGame")
zo_callLater(function()
local settingsMenu = ZO_GameMenu_InGame.gameMenu.headerControls[locSettings]
settingsMenu:SetOpen(true)
SCENE_MANAGER:AddFragment(OPTIONS_WINDOW_FRAGMENT)
KEYBOARD_OPTIONS:ChangePanels(lam.panelID)
for i, child in pairs(settingsMenu.children) do
if type(child) == "table" and child.data.name == KEYBOARD_OPTIONS.panelNames[lam.panelID] then
ZO_TreeEntry_OnMouseUp(child.control, true)
break
end
end
panel:SetHidden(false)
end, 200)
end
It is not finished yet, because there is still one issue - it doesn't properly select button in addon list and scroll list does not move to that button. If I want to fix that, I will have to get reference for addon button. Probably the best would be adding it to panel itself. I have to try what I can do without extensive changes to the code.
EDIT:
Button is selected, but scroll list scrolls to the button only if button list is already initialized, when you open LAM settings for the first time it doesn't work.
Lua Code:
--METHOD: OPEN TO ADDON PANEL--
--opens to a specific addon's option panel
--Usage:
-- panel = userdata; the panel returned by the :RegisterOptionsPanel method
local locSettings = GetString(SI_GAME_MENU_SETTINGS)
function lam:OpenToPanel(panel)
SCENE_MANAGER:Show("gameMenuInGame")
zo_callLater(function()
local settingsMenu = ZO_GameMenu_InGame.gameMenu.headerControls[locSettings]
settingsMenu:SetOpen(true)
SCENE_MANAGER:AddFragment(OPTIONS_WINDOW_FRAGMENT)
KEYBOARD_OPTIONS:ChangePanels(lam.panelID)
for i, child in pairs(settingsMenu.children) do
if type(child) == "table" and child.data.name == KEYBOARD_OPTIONS.panelNames[lam.panelID] then
ZO_TreeEntry_OnMouseUp(child.control, true)
break
end
end
local scroll = LAMAddonPanelsMenuScrollChild
for i = 1, scroll:GetNumChildren() do
local button = scroll:GetChild(i)
if button.panel == panel then
zo_callHandler(button, "OnClicked")
ZO_Scroll_ScrollControlToTop(LAMAddonPanelsMenu, button)
break
end
end
end, 200)
end