ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Options, big ! (LAM) (https://www.esoui.com/forums/showthread.php?t=1358)

Sideshow 05/04/14 05:59 AM

Options, big ! (LAM)
 
Hello

The options panel of "combat cloud" is pretty much the size of a mammoth now, and growing.

Reading about the problems with LAM (although I don't think LAM is the cause), what are MY options?
If I make something on my own, won't I end up with about something that's almost the same as LAM?

Things I tried:

* zo_callLater(CombatCloud_CreateMenu, 500)
* creating just one button, so the user can "manually" load the rest of the options panel with 1 click

For some reason, the 1st is hilarious. The second was actually not a bad idea imho, but the options panel started to behave really weird ???

Any opinions? I'd really hate it to make seperate, "custom" windows and controls, just to edit some flags and numbers in the settings object :p

Divona 05/04/14 07:09 AM

I'm at the same crossroads. Even sub-menu in new version of LAM doesn't seem to help much. :(

Sideshow 05/04/14 07:25 AM

Actually, I'm investigating the second option by reading LAM itself.
It will work, but I will have to update all my controls manually.

Pictures to explain:

- first it will be like this: https://dl.dropboxusercontent.com/u/38282964/1.jpg
- after click: https://dl.dropboxusercontent.com/u/38282964/2.jpg
- after switching to another panel and comming back: https://dl.dropboxusercontent.com/u/38282964/3.jpg

I came to the conclusion that I just need to trigger the "OnShow" event on the controls after clicking on the "Open" button.

Happy to have found this :-)

Sideshow 05/04/14 09:07 AM

When making the LAM calls, I added all controls to a local table.
Afterwards doing something like
Code:

for _, v in ipairs(controls) do
    local onShowFunc = v:GetHandler('OnShow')
    if (onShowFunc ~= nil) then onShowFunc() end
end

or
Code:

for _, v in ipairs(controls) do
    v:SetHidden(true)
    v:SetHidden(false)
end

works, but not for sliders. I have looked at it for half an hour now, but it beats me :(
Switching to another panel and back, still works though...
Aah, the wonders of eso & lua

Iyanga 05/04/14 01:17 PM

Quote:

Originally Posted by Sideshow (Post 6891)
Reading about the problems with LAM (although I don't think LAM is the cause), what are MY options?

Slash commands.

Seerah 05/04/14 03:45 PM

@Sideshow (et al.):

You can create your controls whenever you need to. In your button's OnClick handler, just create the options when the "Show" button is clicked if they haven't been created yet.

The same is true for when using sub menus.

Or if you want to tie into the OnShow event of your panel's header.......

Kith 05/04/14 05:14 PM

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

Sideshow 05/05/14 01:00 AM

Quote:

Originally Posted by Seerah (Post 6927)
@Sideshow (et al.):

You can create your controls whenever you need to. In your button's OnClick handler, just create the options when the "Show" button is clicked if they haven't been created yet.

The same is true for when using sub menus.

Or if you want to tie into the OnShow event of your panel's header.......

That's what I did? When clicking the button, I create all the controls.
LAM adds an OnShow handler which will init the control, well, on show....
Problem is, when creating the controls, the OnShow event is not called (but the controls are still visible... makes sense..).
It is only called when opening the control panel, or by manually calling the OnShow for each control (or tiggering via hide/unhide). This is a problem for sliders... which still only work when a panel change occurred.

Sideshow 05/07/14 01:21 PM

Quote:

Originally Posted by Kith (Post 6931)
....

Thanks a lot, with ZO_OptionsWindow_... everything seems to be OK !

Mitsarugi 05/10/14 10:06 AM

You could have a look at Wykkyd's Addons they use the same option ;)

Quote:

Originally Posted by Sideshow (Post 6891)
Hello

The options panel of "combat cloud" is pretty much the size of a mammoth now, and growing.

Reading about the problems with LAM (although I don't think LAM is the cause), what are MY options?
If I make something on my own, won't I end up with about something that's almost the same as LAM?

Things I tried:

* zo_callLater(CombatCloud_CreateMenu, 500)
* creating just one button, so the user can "manually" load the rest of the options panel with 1 click

For some reason, the 1st is hilarious. The second was actually not a bad idea imho, but the options panel started to behave really weird ???

Any opinions? I'd really hate it to make seperate, "custom" windows and controls, just to edit some flags and numbers in the settings object :p



All times are GMT -6. The time now is 02:04 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI