LibAddonMenu-2.0 - looking for a few people to poke at it
1 Attachment(s)
I finished LAM-2.0 last night. Here is a .zip of the file and some rough starter docs. Hoping to get a few ambitious people to play with it and see if anything breaks. :)
As usual, you need to grab LAM from LibStub first: Lua Code:
METHOD: REGISTER ADDON PANEL Lua Code:
METHOD: REGISTER OPTION CONTROLS Lua Code:
With the new LAM, you only need to make those two function calls and define your data in tables. (See exampleoptions.lua for an example of usage.) Everything else is handled by the library itself. For power-users who wish to get their hands dirty, the widget controls are registered under the LAMCreateControls object. You can bypass LAM and create everything manually - either using your own window/panel, or registering for one through LAM. If you're not so ambitious, but still want something in your options panel that LAM doesn't provide, you can either register your own widget type (see the :RegisterWidget method) or use the "custom" widget type, which is basically just a container. -------------- June 6 Update: - fixed checkbox control for initial value bug - localized game Settings menu lookup & encoded LAM-2.0 Lua file in UTF-8 -------------- June 8 Update: - cleaned up ForceDefaults code - set bg center of addon panel and addon menu to transparent - fixed editbox multiline bug - fixed description anchoring bug - fixed defaults button and confirm dialog - added optional custom function for when resetting defaults (will be called after all settings are reset) |
Wow. It looks really great. Settings for all addons at one place is really good idea. It is much cleaner solution then in LAM 1.0.
I would just suggest adding some kind of transparency to the panel as it will feel more like part of default UI. Also it would be great if you can add an option to turn on/off addon, so all about addons is on the same place. By the way write somewhere that I should not use the same name for my settings menu as I use for global table in my addon... :) EDIT: I think that default widgets should be "hardcoded" so their functionality will be guaranteed. It is really easy to break other addons, if you replace default widget. |
I'll check it out!
edit: btw, I notice you use the term All Rights Reserved, but you probably want to use the actual word "Copyright" followed by the year and your entity name. At least in the US, that is the proper labelling. I don't believe ARR means anything, legally. |
Cool stuff, will take it for a spin this weekend.
|
I'm getting this error, when i am trying to open the settings through the defined /-command:
Code:
user:/AddOns/ThurisazGuildInfo/lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua:52: attempt to index a nil value If you need more information to reproduce it, let me know :) Great work so far. Thanks Seerah! Edit: Just clicked through ZO_GameMenu_InGame via /zgoo. This is just dumb... the table Code:
ZO_GameMenu_InGame.gameMenu.headerControls.Settings Code:
ZO_GameMenu_InGame.gameMenu.headerControls.Einstellungen |
I think i found another little bug in checkbox.lua:70
In function UpdateValue. In order to set the checkbox initial value to the actual current value, shouldn't it be Lua Code:
|
Yay ! It looks very nice Seerah.
I'll get my eyes and hands on this asap. |
Quote:
Quote:
|
I was able to get the French one just by changing the Language.2 cvar. Updating the OP with a new version that includes those two fixes.
|
1 Attachment(s)
I am not sure if i do something wrong but in my french client the table is empty:
|
That is odd...
|
I'll get my hands dirty with this :)
|
A few suggestions/tweaks:
1) Add an author field to the creation. That way can show authors at the top on the settings page but not in the list. 2) Edit box - in description you have "isMultiline" in the table description in the header but "isMultiLine" used below. 3) Add API for appendOption(). It'd be fairly easy to implement (table.insert) and would allow creating panels in a similar style to the current API. Also, if you depend on well-ordered tables (where # works properly), you might want to do this exclusively instead of having the authors spell out their own tables. 4) Currently the text box/description seems to leave a large margin at the top. ------------------------- For the major 'poking around at it', I went ahead and made a quick adapter. (It doesn't work for submenus or for addons where they touch the menu panel directly. But all non-submenu API calls translate just fine.) For the ones where the adapter works, LAM2 seems work pretty well. |
Quote:
2. Ooh, good catch. I guess I forgot to test multi-line edit boxes. 3. I'm not quite certain what you mean here... Could you explain more/better? The index in the table is the order that the options will be created and ordered in the panel. Though perhaps I will switch to next() instead of ipairs()... 4. Do you have a screenshot for this? I did not have this issue. My guess is that you gave the description a title, but left the title empty. The title field is optional. I don't have any plans to include an adaptor with the library. But if it works, that's cool. Thanks! |
1 Attachment(s)
1. I was thinking just have it as an optional field. If present, you could show the title for the panel as
"ADDON NAME by Author". 3. First, code of what was thinking for the API function Lua Code:
Two reasons - 1) update based on a settings change. 2) Allow authors to construct settings table in a manner that is (a bit) closer to how it currently works: Lua Code:
The second point was if you need it to have consecutive indexes (like in your example), you might want to only do this method to guarantee you have that. What happens if you're fed in somthing like the following? Lua Code:
4. A NIL value is being passed in as the title. Screenshot attached. ---------- Yeah, I did an adapter since that's a quick way to test a lot of the functionality with how people are actually using it in addons. I wasn't intending for it to be included, as a lot of addons touch the options panel or the LAM variables directly, making it impossible for them to work through an adapter. |
3. If you want to create controls one by one, you can use the LAMCreateControl methods - this is one of the main reasons why they are exposed. The only thing is that you have to then handle placement yourself. My goal was to make everything easier for people to get their options panels all set up right out of the gate.
If your example table (with non-numerical indexes) is passed through to LAM, then the author isn't following the docs correctly. It would be the same as if they had a typo in a method name, or forgot a required field. Follow the directions (they aren't too complicated), and you'll get your options just the way you want them. ;) 4. Ooh - I see what I did. Copy/paste fail. Fixed now. Hubby has our company at the casino this afternoon/evening, so I can play with this stuff more myself today, too. :) |
Updating download in the top post. Unless anything else comes up horribly wrong, the next update may be to the main download page. :)
In this version... - cleaned up ForceDefaults code - set bg center of addon panel and addon menu to transparent - fixed editbox multiline bug - fixed description anchoring bug - fixed defaults button and confirm dialog - added optional custom function for when resetting defaults (will be called after all settings are reset) |
3. Lua's pass-by-reference does interesting things that let you work around the absence of a one-by-one add API...
Turns out the following code will actually create the header in LAM because tables are passed around as references: Lua Code:
|
LibAddonMenu-2.0 r2 fails to update from vertion r1 with this UI error:
Code:
2014-06-11T13:50:30.007+01:00 |cff0000Gui Warning: Failed to create control 'LAMAddonPanelsMenu'. Duplicate name|r Suggestions: In different languages should be "Addon seetings" translated to localized version. For example use ingame string SI_GAME_MENU_ADDONS (en = "Addons", de = "Erweiterungen", fr = "Extensions"). Instead of: Lua Code:
Lua Code:
|
All times are GMT -6. The time now is 12:13 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI