LibAddonMenu - MultiSelect dropdown widget
For addon developers: This widget is included into base LibAddonMenu's dropdown widget meanwhile.
So you do not need to use this widget here anymore, please switch to normal "dropdown" widget now!
Old description:
A multi select dropdown box widget for the library
LibAddonMenu.
Just install it in addition to LibAddonMenu-2.0 (release 33 or newer is needed!) and use the new widget type "multiselectdropdown" in your addon' settings panel.
Add to your manifest txt file:
Code:
## DependsOn: LibAddonMenuMultiSelectDropdown
Provides the following parameters:
Code:
--For the LAM optionsData at you panel's data
--[[dropdownData = {
type = "multiselectdropdown",
name = "My Multi Select Dropdown", -- or string id or function returning a string
noSelectionText = GetString(SI_KEEPRESOURCETYPE0), -- String or function returning a string to show if no selection was done yet
multiSelectionTextFormatter = "<<1[$d Item/$d Items]>>" -- if specified, this will be used with zo_strformat(multiSelectionTextFormat, numSelectedItems) to set the "selected item text" (optional)
tooltip = "Dropdown's tooltip text.", -- or string id or function returning a string (optional)
multiSelectType = "normal", -- or "allowed". "normal" = a list with key = number index an value = String, "allowed" = a list with key = any String or number and value = boolean. If value == true then the entry will be added. Default = "normal" (optional)
choices = {"table", "of", "choices"},
choicesValues = {"foo", 2, "three"}, -- if specified, these values will get passed to setFunc instead (optional)
choicesTooltips = {"tooltip 1", "tooltip 2", "tooltip 3"}, -- or array of string ids or array of functions returning a string (optional)
getFunc = function() return db.var end,
setFunc = function(var) db.var = var doStuff() end,
sort = "name-up", -- or "name-down", "numeric-up", "numeric-down", "value-up", "value-down", "numericvalue-up", "numericvalue-down" (optional) - if not provided, list will not be sorted
width = "full", -- or "half" (optional)
disabled = function() return db.someBooleanSetting end, -- or boolean (optional)
warning = "May cause permanent awesomeness.", -- or string id or function returning a string (optional)
requiresReload = false, -- boolean, if set to true, the warning text will contain a notice that changes are only applied after an UI reload and any change to the value will make the "Apply Settings" button appear on the panel which will reload the UI when pressed (optional)
default = default.var, -- default values or function that returns the default values (optional)
helpUrl = "https://www.esoui.com/portal.php?id=218&a=faq", -- a string URL or a function that returns the string URL (optional)
reference = "MyAddonMultiSelectDropdown" -- unique global reference to control (optional)
} ]]
Important
The getFunc needs to pass in the table with ONLY the entries which have been selected!
The setFunc will save ONLY the selected entries to the SavedVariables!
You need to specify ALL possible entries with the parameter "choices".
GitHub
https://github.com/Baertram/LibAddon...SelectDropdown
Documentation
Many thanks to zoller27osu for the inspiration/idea.