[SOLVED] Add Checkbox to Keybinding category
tl;dr I just want to add an option checkbox somewhere that toggles a variable.
Hey. I'm entirely new to this. I wanted to update and improve the Junkee addon. I like having a keybind for Junk/Destroy items. I've slowly used the forums and other addons to figure out how to update it, and then to make it save variables and load them. I'm trying to have an option (toggle) to display the keybindings when the Inventory is open; the keybindings are always active, but the descriptions can be toggled on/off. The actual toggling works fine with a variable. I just can't figure out how to create and display the Checkbox correctly. I tried taking code from VotansKeybinder, but it's over my head. I'm not even sure what/how to adapt. How do I add a Checkbox to the Keybinding menu, either next to the category title ("Junkee") or next to a Keybinding option ("Show bindings in Inventory" keybind)? |
If you want to use settings for your addon you shouldn't put them into the game's keybindings menu, but use libAddonMenu2.0 instead to put the checkbox there. Ppl are used to it and won't enable addon related stuff into the keyninds list.
Check the addons section here for this library and how to use it. Or check Dustman code how you can add LAM. |
Thanks for the advice. It's good. I've been trying to do that, but I keep getting:
Code:
EsoUI/Libraries/Utility/ZO_Hook.lua:33: function expected instead of nil Code:
LAM:RegisterAddonPanel("Junkee", panelData) |
Go into the lam files, and open the controls folder. Open panel.Lua and the files of the other controls you are using. There should be a comment at the start, make sure you have all the required fields. Also make sure the table is in the correct format
|
Quote:
Code:
local wm = GetWindowManager() Code:
local panelData = { |
Did you include LibSub and all LAM files in your manifest.txt before your files?
|
Quote:
Code:
... |
You haven't included any LAM files in your manifest!!! The manifest tells the game what files to load. So the game will load the files that are listed. If you don't list a file, it won't load. As instructed by the addon, you would have my tile lines of libs/libaddonmenu/controls/controlname.lua as well as lines for libstub. All rhe optional depends on does is say 'if the user has LAM as a standalone addon, load the standalone LAM first.'
|
Uhm afaik LAM does not have 'true' checkboxes, yet, only those 'On......Off' controls? It's a feature that I suggested some time ago.
|
Quote:
|
Quote:
Code:
local LAM = LibStub("LibAddonMenu-2.0") |
I redid it with the instructions more carefully, fixing my .txt file and how I add the LAM module. I followed the ZAM Stats module on how they load and use it, every part. Still same error. The menu is loaded, but when I interact with Inventory it errors.
Code:
## OptionalDependsOn: LibAddonMenu-2.0 Code:
-- Add menu with options. |
So, finally after debugging LAM, adding a printout of the actual error, it comes down to Junkee.savedVars being nil. Which makes no sense. My code sets/loads it as instructed in tutorials. In Loaded event:
Code:
Junkee.savedVars = ZO_SavedVars:New("JunkeeAddonSavedVars", 1, nil, Junkee.defaults) |
Son of a gun, I found it.
Code:
local panelData = { Code:
-- addonID = "string"; unique ID which will be the global name of your panel |
All times are GMT -6. The time now is 11:46 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI