Download
(13 Kb)
Download
Updated: 08/11/23 05:06 AM
Addon for:
LibAddonMenu-2.0.
Pictures
File Info
Compatibility:
base-game patch (9.1.5)
Necrom (9.0.0)
Scribes of Fate (8.3.5)
Firesong (8.2.5)
Lost Depths (8.1.5)
High Isle (8.0.0)
Updated:08/11/23 05:06 AM
Created:07/31/22 02:25 PM
Monthly downloads:2,636
Total downloads:53,594
Favorites:6
MD5:
LibAddonMenu - DualListBox widget  Popular! (More than 5000 hits)
Version: 2
by: Baertram [More]
This library is buggy and was disabled until further tested and LibShifterBox (if any update is needed, but currently it looks like it is needed) was updated.


LibAddonMenu - DualListBox widget

A dual list box (left, right) 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 "duallistbox" in your addon'
settings panel.

Add to your manifest txt file:
Code:
## DependsOn: LibAddonMenuDualListBox
This widget is based on LibShifterBox which is a required dependency:
https://www.esoui.com/downloads/info...hifterBox.html

It will provide 2 list boxes, left and right, where you can move items from left to right.

Provides the following parameters:

Code:
--SavedVariables example: Defaults
local defaults = {
    --Attention: Left and right list MUST have unique keys in combination: Means same key cannot be in both tables!
    --If you use resetFunc at the widget to clear the left list and right list manually make sure to always clear both tables
    --before trying to add new entries! Else the keys might still be in rightList as you try to add default keys (with same key) in leftList e.g.
   leftList = { [1] = "Test 1", [2] = "Test 2" },
   rightList = { [3] = "Test 3", [4] = "Test 4"}
}
--SavedVariables example: SV table
local settings = ZO_SavedVars:NewAccountWide(MyAddonSVTableName, 1, "settingsForAll", defaults, GetWorldName())


--settings.testLeftList = {} --If SavedVariables are empty: should be filled from defaults SV "defaults" via entry defaultLeftList 
--settings.testRightList = {} --If SavedVariables are empty: should be filled from defaults SV "defaults" via entry defaultRightList

Code:
--For the LAM optionsData at you panel's data
{
            type        = "duallistbox",
            name        = "MyAddonCustomControlName",
            reference   = "MyAddonCustomControl", -- unique name for your control to use as reference (optional) The <reference>.dualListBox is the direct reference to the dual list box control then
            refreshFunc = function(customControl) end, -- function to call when panel/controls refresh (optional)
            width       = "full", -- or "half" (optional)
            minHeight   = function() return 26 end, --or number for the minimum height of this control. Default: 26 (optional)
            maxHeight   = function() return 300 end, --or number for the maximum height of this control. Default: 4 * minHeight (optional)

            getFuncLeftList = function() return settings.testLeftList end,
            setFuncLeftList = function(values) settings.testLeftList = values end,
            getFuncRightList = function() return settings.testRightList end,
            setFuncRightList = function(values) settings.testRightList = values end,
            defaultLeftList =  defaults.leftList, --table or function returning a table with the default entries at the left list (optional). Left and right list's keys must be unique in total!
            defaultRightList = defaults.leftList, --table or function returning a table with the default entries at the right list (optional). Left and right list's keys must be unique in total!
            resetFunc = function(customControl) your code to reset the 2 listBoxes now. customControl.dualListBox provides functions ClearLeftList(), ClearRightList(), AddEntriesToLeftList(listEntries), AddEntriesToRightList(listEntries)  end, (optional)
            --======================================================================================================================
            -- -v- The dual lists setup data                                                                                -v-
            --======================================================================================================================
            setupData   = {
                --The overall dual list box control setup data
                name                 = "LAM_DUALLISTBOX_EXAMPLE1",
                width                = 580, --number of function returning a number for the width of both list boxes together
                height               = 200, --number of function returning a number for the height of both list boxes together. minHeight of the LAM control needs to be >= this value!
                --======================================================================================================================
                ----  -v- The custom settings for the dual lists                                                            -v-
                --======================================================================================================================
                --The setup data for the lists
                -->The custom settings are defined via the library LibShifterBox. You can find the documentation here:
                -->https://github.com/klingo/ESO-LibShifterBox#api-reference    Search for "customSettings"
                customSettings       = {
                    enabled            = true, -- boolean value or function returning a boolean to tell if the dual list box widget is enabled (default = true)? (optional)
                    showMoveAllButtons = true, -- the >> and << buttons to move all entries can be hidden if set to false (default = true). (optional)
                    dragDropEnabled    = true, -- entries can be moved between lsit with drag-and-drop (default = true). (optional)
                    sortEnabled        = true, -- sorting of the entries can be disabled (default = true). (optional)
                    sortBy             = "value", -- sort the list by value or key (allowed are: "value" or "key")  (default = "value"). (optional)
                    disabled = function()
                        FCOUS.disabledLSB = FCOUS.disabledLSB or false
                        return FCOUS.disabledLSB
                    end,

                    --======================================================================================================================
                    leftList           = {                -- list-specific settings that apply to the LEFT list
                        title                          = "Title left", -- the title/header of the list (default = ""). (optional)
                        rowHeight                      = 32, -- the height of an individual row/entry (default = 32). (optional)
                        rowTemplateName                = "ShifterBoxEntryTemplate", -- an individual XML (cirtual) control can be provided for the rows/entries (default = "ShifterBoxEntryTemplate"). (optional)
                        emptyListText                  = GetString(LIBSHIFTERBOX_EMPTY), -- the text to be displayed if there are no entries left in the list (default = GetString(LIBSHIFTERBOX_EMPTY)). (optional)
                        fontSize                       = 18, -- size of the font (default = 18). (optional)
                        --[[
                        rowDataTypeSelectSound         = "ABILITY_SLOTTED", -- an optional sound to play when a row of this data type is selected (default = "ABILITY_SLOTTED"). (optional)
                        rowOnMouseRightClick           = function(rowControl, data)
                            -- an optional callback function when a right-click is done inside a row element (e.g. for custom context menus) (optional)
                            d("LSB: left OnMouseRightClick: " .. tostring(data.tooltipText))   -- reading custom 'tooltipText' from 'rowSetupAdditionalDataCallback'
                        end,
                        rowSetupCallback               = function(rowControl, data)
                            -- function that will be called when a control of this type becomes visible (optional)
                            d("LSB: left RowSetupCallback")                      -- Calls self:SetupRowEntry, then this function, finally ZO_SortFilterList.SetupRow
                        end,
                        rowSetupAdditionalDataCallback = function(rowControl, data)
                            -- an optional function to extended data table of the row with additional data during the 'rowSetupCallback' (optional)
                            d("LSB: left SetupAdditionalDataCallback")
                            data.tooltipText = data.value
                            return rowControl, data                         -- this callback function must return the rowControl and (enriched) data again
                        end,
                        rowResetControlCallback        = function()
                            -- an optional callback function when the datatype control gets reset (optional)
                            d("LSB: left RowResetControlCallback")
                        end,
                        ]]
                    },

                    --======================================================================================================================
                    rightList          = {               -- list-specific settings that apply to the RIGHT list
                        title                          = "Title right",
                        --rowHeight = 32,
                        --rowTemplateName = "ShifterBoxEntryTemplate",
                        --emptyListText = GetString(LIBSHIFTERBOX_EMPTY),
                        --fontSize = 18,
                        --rowDataTypeSelectSound = "ABILITY_SLOTTED",
                        --[[
                        rowOnMouseRightClick           = function(rowControl, data)
                            -- an optional callback function when a right-click is done inside a row element (e.g. for custom context menus) (optional)
                            d("LSB: right OnMouseRightClick: " .. tostring(data.tooltipText))   -- reading custom 'tooltipText' from 'rowSetupAdditionalDataCallback'
                        end,
                        rowSetupCallback               = function(rowControl, data)
                            -- function that will be called when a control of this type becomes visible (optional)
                            d("LSB: right RowSetupCallback")                      -- Calls self:SetupRowEntry, then this function, finally ZO_SortFilterList.SetupRow
                        end,
                        rowSetupAdditionalDataCallback = function(rowControl, data)
                            -- an optional function to extended data table of the row with additional data during the 'rowSetupCallback' (optional)
                            d("LSB: right SetupAdditionalDataCallback")
                            data.tooltipText = data.value
                            return rowControl, data                         -- this callback function must return the rowControl and (enriched) data again
                        end,
                        rowResetControlCallback        = function()
                            -- an optional callback function when the datatype control gets reset (optional)
                            d("LSB: right RowResetControlCallback")
                        end,
                        ]]
                    },

                    --======================================================================================================================
                    --Callbacks that fire as a list is created, filled, cleared, entry is slected, unselected, row mouseOver, row mouseExit, dragDropStart, dragDropEnd, etc. happens
                    callbackRegister   = {                                    -- directly register callback functions with any of the exposed events
                        [LibShifterBox.EVENT_LEFT_LIST_ROW_ON_MOUSE_ENTER]  = function(rowControl, shifterBox, data)
                            d("LSB: LeftListRowOnMouseEnter")
                        end,
                        [LibShifterBox.EVENT_RIGHT_LIST_ROW_ON_MOUSE_ENTER] = function(rowControl, shifterBox, data)
                            d("LSB: RightListRowOnMouseEnter")
                        end,
                    }
                },

                --======================================================================================================================
                ----  -^- The custom settings for the dual lists                                                            -^-
                --======================================================================================================================
            }
},

GitHub
LibAddonMenu - DualListBox widget

Documentation
v2 - 2023-08-11
Updated LAM version
Fixed LibShifterBox version to 500
Added possible fix for row event problems
Archived Files (1)
File Name
Version
Size
Uploader
Date
1
13kB
Baertram
07/31/22 02:25 PM


There have been no comments posted to this file.
Be the first to add one.



Category Jump: