Go to Page... |
Compatibility: | Gold Road (10.0.0) |
Updated: | 06/03/24 01:19 PM |
Created: | 02/14/14 10:28 PM |
Monthly downloads: | 37,481 |
Total downloads: | 5,012,387 |
Favorites: | 2,826 |
MD5: |
IMPORTANT In case you get an error that contains text like this: user:/AddOns/<some other addon>/Libs/LibAddonMenu-2.0 Some other addon you have installed likely contains an old version of LibAddonMenu which is loaded before the most current one. Make sure to search for LibAddonMenu-2.0 folders in your AddOns folder and delete all of them. Afterwards install the latest version of LibAddonMenu-2.0 separately. Check Kyzderp's guide for more detailed instructions |
## DependsOn: LibAddonMenu-2.0
## DependsOn: LibAddonMenu-2.0>=30
local LAM = LibAddonMenu2 local saveData = {} -- TODO this should be a reference to your actual saved variables table local panelName = "MyAddOnSettingsPanel" -- TODO the name will be used to create a global variable, pick something unique or you may overwrite an existing variable! local panelData = { type = "panel", name = "MyAddOn Settings", author = "me", } local panel = LAM:RegisterAddonPanel(panelName, panelData) local optionsData = { { type = "checkbox", name = "My First Checkbox", getFunc = function() return saveData.myValue end, setFunc = function(value) saveData.myValue = value end } } LAM:RegisterOptionControls(panelName, optionsData)
- use the callbacks "LAM-PanelControlsCreated", "LAM-PanelOpened" and "LAM-PanelClosed" instead- updated Brazilian translation (thanks FelipeS11)
- the panel control is returned by RegisterAddonPanel- added "translation", "feedback" and "donation" properties to panel (#88, thanks Baertram)
- all three (and also the "website" property) accept a function or a string- added "disabled" and "disabledLabel" property for submenus (#86, #90, thanks klingo)
- the function receives the value, min and max as arguments and has to return a clamped value- added optional support for LibDebugLogger
- in case it is loaded, it logs the full error when control creation failed- updated LibStub to r5
- when set to true it changes the text color of the button to red and opens a dialog which shows the label and the warning text before running the callback- added new options for sliders and fixed some bugs (#49)
- autoSelect (boolean): when set to true it makes the input field select all text when it gains focus- for other internal code changes take a look at the git history
- inputLocation (string): setting it to "right" will move the input field to the right side of the slider and make it slightly bigger. For aesthetic reasons this should only be used in custom panels and not in the addon menu
- clampInput (boolean): true by default and if set to false it allows the input values of the slider to exceed the min and max value
- NOTE: the menu is now a bit wider than before, if you created custom elements you might need to update them accordingly- added search box to addon list (thanks votan & merlight)
File Name |
Version |
Size |
Uploader |
Date |
2.0 r36 |
49kB |
sirinsidiator |
03/10/24 04:21 PM |
|
2.0 r35 |
49kB |
sirinsidiator |
10/31/23 01:16 PM |
|
2.0 r34 |
48kB |
sirinsidiator |
06/06/22 05:35 AM |
|
2.0 r33 |
48kB |
sirinsidiator |
03/14/22 02:51 PM |
|
2.0 r32 |
48kB |
sirinsidiator |
12/17/20 02:04 PM |
|
2.0 r31 |
49kB |
sirinsidiator |
06/21/20 03:06 PM |
|
2.0 r30 |
48kB |
sirinsidiator |
10/21/19 03:23 AM |
|
2.0 r29 |
48kB |
sirinsidiator |
05/07/19 11:00 AM |
|
2.0 r28 |
47kB |
sirinsidiator |
05/01/19 09:33 AM |
|
2.0 r27 |
47kB |
sirinsidiator |
04/18/19 03:07 PM |
|
2.0 r26 |
45kB |
sirinsidiator |
05/21/18 02:36 AM |
|
2.0 r25 |
45kB |
sirinsidiator |
09/29/17 12:28 PM |
|
2.0 r24 |
45kB |
sirinsidiator |
07/14/17 01:00 PM |
|
2.0 r23 |
42kB |
sirinsidiator |
10/30/16 10:00 AM |
|
2.0 r22 |
39kB |
sirinsidiator |
08/06/16 07:42 AM |
|
2.0 r21 |
38kB |
sirinsidiator |
07/17/16 11:04 AM |
|
2.0 r20 |
41kB |
sirinsidiator |
03/26/16 10:45 AM |
|
2.0 r19 |
37kB |
sirinsidiator |
02/24/16 12:24 PM |
|
2.0 r18 |
36kB |
sirinsidiator |
06/14/15 01:12 PM |
|
2.0 r17 |
30kB |
sirinsidiator |
02/22/15 11:09 AM |
|
2.0 r16 |
27kB |
Seerah |
11/02/14 02:03 PM |
|
2.0 r14 |
26kB |
Seerah |
07/27/14 10:17 PM |
|
2.0 r13 |
26kB |
Seerah |
07/20/14 09:35 PM |
|
2.0 r12 |
26kB |
Seerah |
07/20/14 07:55 PM |
|
2.0 r11 |
26kB |
Seerah |
07/19/14 02:49 PM |
|
2.0 r10 |
25kB |
Seerah |
07/13/14 09:18 PM |
|
2.0 r9 |
25kB |
Seerah |
07/05/14 06:55 PM |
|
2.0 r8 |
25kB |
Seerah |
06/22/14 09:47 PM |
|
2.0 r7 |
25kB |
Seerah |
06/15/14 05:17 PM |
|
2.0 r6 |
25kB |
Seerah |
06/13/14 11:28 PM |
|
2.0 r5 |
25kB |
Seerah |
06/12/14 10:32 PM |
|
2.0 r4 |
25kB |
Seerah |
06/11/14 08:56 PM |
|
2.0 r3 |
25kB |
Seerah |
06/11/14 07:49 PM |
|
2.0 r2 |
24kB |
Seerah |
06/10/14 10:06 PM |
|
1.0 r8 |
6kB |
Seerah |
05/24/14 10:01 PM |
Comment Options |
Seerah |
View Public Profile |
Send a private message to Seerah |
Find More Posts by Seerah |
Add Seerah to Your Buddy List |
05/31/14, 01:28 PM | |||
Forum posts: 9
File comments: 523
Uploads: 0
|
|
||
|
ivanwfr |
View Public Profile |
Send a private message to ivanwfr |
Send email to ivanwfr |
Find More Posts by ivanwfr |
Add ivanwfr to Your Buddy List |
05/31/14, 12:39 PM | ||
|
I'm glad you got something working for you. I've been spending my time totally rewriting the library from the ground up. I'm sorry if I'm not interested in spending that time instead on finding a solution for you and your fringe-case scenario in something that will be obsolete soon. |
|
|
Seerah |
View Public Profile |
Send a private message to Seerah |
Send email to Seerah |
Find More Posts by Seerah |
Add Seerah to Your Buddy List |
05/31/14, 09:22 AM | |
Forum posts: 9
File comments: 523
Uploads: 0
|
Well, I found the solution, and not thanks to you as it looks like I'm the only one interested
Now I can use a workaround with a slightly modified version of LibAddonMenu. Dropdown controls behave as they should when the selected choice is changed internally, with some assistance. The remaining nuisance is a rogue call to setFunc() with the previous value that I need to mask for a short period of time. A timer has to drop the shield with a small delay to allow further user selection from the menu. Code:
--[[-- STUCK-ON-LAST-CHANGE local selectedName ZO_PreHookHandler(dropmenu.m_selectedItemText, "OnTextChanged", function(self) if dropmenu.m_selectedItemData then selectedName = dropmenu.m_selectedItemData.name setText(self, selectedName) setFunc(selectedName) end end) --]] ---[[-- SYNCHRONIZED-WITH-ADDON ZO_PreHookHandler(dropmenu.m_selectedItemText, "OnTextChanged", function(self) if dropmenu.m_selectedItemData then setFunc( dropmenu.m_selectedItemData.name ) -- Send user selection (to addon) dropmenu:SetSelectedItem( getFunc() ) -- To update display (from addon) end end) ---]] |
|
ivanwfr |
View Public Profile |
Send a private message to ivanwfr |
Send email to ivanwfr |
Find More Posts by ivanwfr |
Add ivanwfr to Your Buddy List |
05/30/14, 12:05 PM | ||
Forum posts: 9
File comments: 523
Uploads: 0
|
Calling /reloadui is precisely the part I worked so hard to avoid. How could I let it go now that everything except the menu works fine? o.O Calling /reloaui only to synchronize menu controls is a killer when I could manage to make preset swap instant. |
|
|
ivanwfr |
View Public Profile |
Send a private message to ivanwfr |
Send email to ivanwfr |
Find More Posts by ivanwfr |
Add ivanwfr to Your Buddy List |
05/30/14, 11:52 AM | |
|
It's probably something that I coded around before that was fixed or changed since then. (LAM was written back in January.)
setFunc() is only called in the pre-hook for "OnTextChanged". So, it looks like setFunc() could be getting called twice due to - the "OnShow" calling :SetSelectedItem() which changes the text - the setText function (in the pre-hook) now also calling :SetSelectedItem() If your addon works best with a reload when changing presets, then have a warning icon next to your dropdown with a tooltip that changing the preset will result in a reload UI. Things will be much better in LAM 2.0.
Last edited by Seerah : 05/30/14 at 11:54 AM.
|
|
Seerah |
View Public Profile |
Send a private message to Seerah |
Send email to Seerah |
Find More Posts by Seerah |
Add Seerah to Your Buddy List |
05/30/14, 10:41 AM | ||
Forum posts: 9
File comments: 523
Uploads: 0
|
Here is how I "Refresh" the window and it works fine until it calls the setFunc once (as you can see in the attached screenshot): Code:
-- update settings control display by having them call their respective getFunc() function Update_SettingsControls() local control, handler for k, v in pairs( QSB.SettingsControls ) do control = QSB.SettingsControls[k] handler = control:GetHandler("OnShow") if handler then handler() end end end - SelectPreset(selectedPreset) ... push current preset ... pop another - CopyNotNilSettingsFromTo(from, to) ... saves and/or restore presets into/from SavedVars (+avoid recursion) Current version of LibAddonMenu works fine up to a point where ZO_PreHookHandler() callback processing has been used once. What I am looking for is some insight you might have about what's involved in there that could explain why OnShow() results in setFunc(current-menu-displayed-value) called twice as detailed in my story bellow ...? |
|
|
ivanwfr |
View Public Profile |
Send a private message to ivanwfr |
Send email to ivanwfr |
Find More Posts by ivanwfr |
Add ivanwfr to Your Buddy List |
05/30/14, 08:32 AM | |
|
Well, as already stated, LAM 2.0 will allow you to refresh the window.
In the set function for your dropdown, you should change the value of each relevant variable in your saved variables (then do whatever is necessary to make those changes in your addon). Refreshing the options window will then display the new values for each setting. I realize that you're asking about the current version, but I'm not at my computer atm to look at it. |
|
Seerah |
View Public Profile |
Send a private message to Seerah |
Send email to Seerah |
Find More Posts by Seerah |
Add Seerah to Your Buddy List |
05/30/14, 07:28 AM | |||
Forum posts: 9
File comments: 523
Uploads: 0
|
Hi, my first post here, with my compliments to the author!
My request is somehow related to the previous one but in a more specific case-study way: I am working with Presets, meaning I have to enforce a whole set of different snapshots of SavedVariables tables. To my satisfaction, I could find a way to embed all 5 of those collections in such a way that they all get in and out of the SavedVariable folder avoiding those endless loop always on the lookout when you have such a weird idea. This said, I would like having LibAddonMenu cooperate when user is swapping presets. As it does not work as expected, I report here in order to get some clues on the way to understanding what is going on. Maybe I missed something I should do, maybe what I need requires some new implementation, I don't know... Here is the whole story as of today as I reported in my comments of Greymind Quick Slot Bar forums:
Last edited by ivanwfr : 05/30/14 at 07:30 AM.
|
||
|
ivanwfr |
View Public Profile |
Send a private message to ivanwfr |
Send email to ivanwfr |
Find More Posts by ivanwfr |
Add ivanwfr to Your Buddy List |
05/26/14, 08:31 PM | ||
|
Re: Is there a way to refresh the Addon menu?
For now, though, you will have to manually update each option. |
|
|
Seerah |
View Public Profile |
Send a private message to Seerah |
Send email to Seerah |
Find More Posts by Seerah |
Add Seerah to Your Buddy List |
05/26/14, 07:56 PM | |
Is there a way to refresh the Addon menu?
Is there a way to refresh the Addon menu?
I have an option in one of my addons that when switched loads a different set of variables. Same variable names, but different values. I am looking to refresh the menu so it will go find the current values again. If you have an ideas, I'd greatly appreciate it. |
|
|
RavenDT |
View Public Profile |
Send a private message to RavenDT |
Send email to RavenDT |
Find More Posts by RavenDT |
Add RavenDT to Your Buddy List |
05/23/14, 11:59 AM | ||
|
|
|
|
Seerah |
View Public Profile |
Send a private message to Seerah |
Send email to Seerah |
Find More Posts by Seerah |
Add Seerah to Your Buddy List |
05/23/14, 01:42 AM | |||
Issue fixed - Thank you.
Last edited by Edda : 05/23/14 at 01:43 AM.
|
|||
|
Edda |
View Public Profile |
Send a private message to Edda |
Send email to Edda |
Find More Posts by Edda |
Add Edda to Your Buddy List |
05/22/14, 07:34 PM | ||
|
Last edited by Seerah : 05/22/14 at 07:35 PM.
|
|
|
Seerah |
View Public Profile |
Send a private message to Seerah |
Send email to Seerah |
Find More Posts by Seerah |
Add Seerah to Your Buddy List |
05/22/14, 04:12 PM | ||
|
||
|
Swizzy |
View Public Profile |
Send a private message to Swizzy |
Send email to Swizzy |
Find More Posts by Swizzy |
Add Swizzy to Your Buddy List |