View Single Post
05/04/14, 05:14 PM   #7
Kith
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 49
I'm still using the basic LAM functionality but I ... mucked around... with the code quite a bit to 'fake' adding tabbed panels in my latest mod (S'rendarr) to avoid the anchors processing message. I have it set to load only the tabs themselves when the mod is loaded, everything else is loaded at run time when its actually used. This may help if you want to try breaking up options in a similar manner.

Lua Code:
  1. -- this is added into my settings initialization
  2. ZO_PreHook('ZO_OptionsWindow_ChangePanels', function(panel)
  3.     if (panel == controlPanel) then
  4.         if (not tabPanels[1]) then -- first time viewing settings, create first tab
  5.             BuildTabPanel(1)
  6.         end
  7.     end

BuildTabPanel actually creates the LAM items for that panel at the time and (with 4 tab buttons in my options), each of the 4 creates its own panel only when first clicked. I've faked the panel method by calling SetParent on each LAM item after creation to attach it to a CT_CONTROL panel which is then hidden/shown as needed.

The only funky bit that needs to be done to make it work this way is to call these two functions after creating the new elements :
Lua Code:
  1. ZO_OptionsWindow_UpdatePanelOptions(controlPanel, 1) -- force option update to properly initialize settings
  2. ZO_OptionsWindow_ChangePanels(controlPanel)
  3. -- where controlPanel = your return from a new panel in LAM (the # id of your panel)
This forces the ZO code to refresh your settings to be properly interactable (they aren't without the first one) and show their proper values (they don't without the second one).

Just as an aside, due to the order of events firing when opening the settings I used zo_calllater to show some examples so its not that hilarious :P

Last edited by Kith : 05/04/14 at 05:17 PM.
  Reply With Quote