Download
(35 Kb)
Download
Updated: 07/25/21 02:44 PM
Pictures
File Info
Compatibility:
Waking Flame (7.1.5)
Blackwood (7.0.5)
Updated:07/25/21 02:44 PM
Created:08/18/19 08:03 AM
Monthly downloads:2,702
Total downloads:208,367
Favorites:111
MD5:
LibShifterBox  Popular! (More than 5000 hits)
Version: 0.5.0
by: Klingo [More]
Disclaimer: LibShifterBox is currently in BETA status. APIs might change again and further bugfixes are to be expected.

Features
  • Create ShifterBoxes (also known as Dual-Listboxes) for easier selection of multiple entries
  • Shift items with the [<] and [>] buttons, or just use drag-and-drop
  • Entries can optionally be added under different categories to easily show/hide them based on other events
  • Define your own titles for the ListBoxes, or just leave them out
  • Simple access to know which entries are in which ListBox
  • Change Dimension, Hidden and Enabled state at any time
  • Provide your own XML Templates to be used for the individual rows
  • Many events you can register your callback functions to


Quick Start

Add LibShifterBox as a dependency to your add-on manifest:
Code:
## DependsOn: LibShifterBox
Then you can create a shifterBox instance, anchor it to another control and start adding entries like this:
Lua Code:
  1. local customSettings = {
  2.     leftList = {
  3.         title = "Lefties",
  4.     },
  5.     rightList = {
  6.         title = "Righties",
  7.     }
  8. }
  9. local shifterBox = LibShifterBox("MyAddon", "MyShifterBox", parentControl, customSettings)
  10. shifterBox:SetAnchor(TOPLEFT, headerControl, BOTTOMLEFT, 0, 20) -- required to correctly position/anchor it in your UI
  11. shifterBox:SetDimensions(300, 200) -- optionally set your own overall dimensions of the shifterBox
  12. shifterBox:AddEntriesToLeftList({[1] = "AAA", [2] = "BBB", [3] = "CCC"}) -- add three entries to the left list
  13. shifterBox:AddEntryToRightList(4, "DDD") -- add one entry to the right list

A more extensive Quick Start Example can be found here


API Reference
Known Issues
  • When programmatically deselecting an entry where the mouse cursor hovers over; the font color temporarily changes to white

Info
0.5.0 (July 25, 2021)
- updated to APIVersion 100035 (Blackwood) (#24, thanks Baertram)
- added many more events and callback functions, improved drag&drop visualisation, and other code improvements (#24, thanks Baertram / #25)

0.4.1 (March 06, 2021)
- updated to APIVersion 100034 (Flames of Ambition)) (#21)
- fixed an issue where the (sorting) headers dit not get properly disabled (#22)

0.4.0 (January 24, 2021)
- added two new events: EVENT_LEFT_LIST_CLEARED, EVENT_RIGHT_LIST_CLEARED (#19)
- fixed an issue where the << and >> buttons were not enabled again after adding a new entry (#16)
- fixed an issue with moving selected entries when a new entry is added in between (#17 / #18)

0.3.4 (November 03, 2020)
- updated to APIVersion 100033 (Markarth) (#11)
- fixed an issue where non-EN localization was not applied (#10)

0.3.3 (September 05, 2020)
- updated to APIVersion 100032 (Stonethorn)

0.3.2 (April 24, 2020)
- updated to APIVersion 100031 (Graymoor)

0.3.1 (February 24, 2020)
- updated to APIVersion 100030 (Harrowstorm)

0.3.0 (December 17, 2019)
- add two new library functions: [RegisterCallback] and [UnregisterCallback]
- updated to APIVersion 100029 (Dragonhold)

0.2.0 (August 21, 2019)
- restructured customSettings (breaking change!)
- add [dragDropEnabled] setting to control the drag-and-drop feature (by Baertram)
- add [fontSize] setting to change the font of the entries
- add localization for default empty text

0.1.1 (August 18, 2019)
- add [sortEnabled] customSetting as proposed by Baertram
- add additional shortcut parameters to .Create/:New as proposed by Baertram

0.1.0 (August 18, 2019)
- initial (beta) release
Optional Files (0)


Archived Files (7)
File Name
Version
Size
Uploader
Date
0.4.1
30kB
Klingo
03/06/21 08:14 AM
0.4.0
30kB
Klingo
01/24/21 11:02 AM
0.3.4
29kB
Klingo
11/02/20 05:08 PM
0.3.3
29kB
Klingo
09/05/20 06:19 AM
0.3.2
29kB
Klingo
04/24/20 06:37 AM
0.3.1
29kB
Klingo
02/24/20 10:19 AM
0.3.0
29kB
Klingo
12/17/19 05:08 AM


Post A Reply Comment Options
Unread 08/11/23, 02:47 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5989
Uploads: 78
Basically editing the files locally and changing the version to 500 "might" work but is no good idea
Reason:

I had worked on LibShifterBox locally and provided new features/fixes in version 510, but it was never released so far I think I remember.
Guess I released the plugin as "BETA state" and forgot to include LibShifterbo 510 there with it, or make somehow the official LibShifterBox update to 510 then. Sorry

But if I remember correctly the plugin was using a function that only the version 510 of LibShifterBox provides!
And if this is the case your local change would make it error as the plugin would load and then fail to find that function/code in LibShifterBox 500.
I need to find the 510 files again and check the differences.

Edit:
I've updated the LAM 2.0 plugin so that the needed version of LibShifterBox will be 500.

LibAddonMenu DualListBox plugin is still in beta phase and the very first line of the plugin's description already says it s buggy and needs further testing and a LibShifterBox update
But I actually not know anymore what exactly it was, something with the drag&drop or the events fired form the LSB.
Last edited by Baertram : 08/11/23 at 09:28 AM.
Report comment to moderator  
Reply With Quote
Unread 08/10/23, 10:24 PM  
DakJaniels
AddOn Author - Click to view AddOns

Forum posts: 27
File comments: 120
Uploads: 4
Originally Posted by DruiD
Howdy,
LibShifterBox
- Is coming up as olderversion \newer required- for a dependancy for LibAddonMenu2-0 - Dual List boxes.
- Is this just a simple versioning code line I can change or has impact in use off dual list boxing?

I have some mod issues annd trrying to narrrow down out of date mods\lib that might be causing it.
You can edit the txt file of LibAddonMenu2-0 - Dual List boxes at the Depends on line. @Baertram might need to push out a fix officially if you don’t what to edit it yourself
Report comment to moderator  
Reply With Quote
Unread 08/10/23, 08:53 PM  
DruiD

Forum posts: 2
File comments: 29
Uploads: 0
Howdy,
LibShifterBox
- Is coming up as olderversion \newer required- for a dependancy for LibAddonMenu2-0 - Dual List boxes.
- Is this just a simple versioning code line I can change or has impact in use off dual list boxing?

I have some mod issues annd trrying to narrrow down out of date mods\lib that might be causing it.
Report comment to moderator  
Reply With Quote
Unread 08/21/22, 10:37 AM  
Honestaly

Forum posts: 3
File comments: 59
Uploads: 0
Is there a version 5.1.0 that should be up here?

FCO Item Saver is requiring version 5.1.0 but 5.0.0 is the latest here.
Report comment to moderator  
Reply With Quote
Unread 04/19/22, 04:55 PM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5989
Uploads: 78
Report comment to moderator  
Reply With Quote
Unread 07/25/21, 03:00 PM  
Klingo
AddOn Author - Click to view AddOns

Forum posts: 16
File comments: 200
Uploads: 3
New version available with many improvements such as a much nicer drag&drop visualization, many more events to register callbacks for and other "under the hood" changes.

Thanks a lot for your contribution Baertram!


In addition, AddonVersion is now also in line with Version:
## Version: 0.5.0
## AddOnVersion: 000500
Report comment to moderator  
Reply With Quote
Unread 01/24/21, 12:35 PM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5989
Uploads: 78
You are already able to, just use LAM's custom control and add the LibShifterbox there via the custom control's "setupFunc" (added via LAM 2.0 r32)
Lua Code:
  1. ...  
  2. createFunc = function (lamCustomControl)
  3.    local customSettings = {
  4.        leftList = {
  5.            title = "Lefties",
  6.        },
  7.        rightList = {
  8.            title = "Righties",
  9.        }
  10.    }
  11.    local shifterBox = LibShifterBox("MyAddon", "MyShifterBox", lamCustomControl, customSettings)
  12.    shifterBox:AddEntriesToLeftList({[1] = "AAA", [2] = "BBB", [3] = "CCC"}) -- add three entries to the left list
  13.    shifterBox:AddEntryToRightList(4, "DDD") -- add one entry to the right list
  14. end,
  15. minHeight = 400,
  16. ...
> Before LAM 2.0 r32 you could use the "refreshFunc" of the customControl to add the LibShifterBox "once".

Lua Code:
  1. --[[customData = {
  2.     type = "custom",
  3.     reference = "MyAddonCustomControl", -- unique name for your control to use as reference (optional)
  4.     createFunc = function(customControl) end, -- function to call when this custom control was created (optional)
  5.     refreshFunc = function(customControl) end, -- function to call when panel/controls refresh (optional)
  6.     width = "full", -- or "half" (optional)
  7.     minHeight = function() return db.minHeightNumber end, --or number for the minimum height of this control. Default: 26 (optional)
  8.     maxHeight = function() return db.maxHeightNumber end, --or number for the maximum height of this control. Default: 4 * minHeight (optional)
  9. } ]]
Make sure to set the minHeight of the customControl to something that will be at the ~ height of the LibShifterBox or it might be out of bounds!

Originally Posted by Echomap
Oh fun! Yes, this would be nice to be able to use in settings, via LibAddonMenu!

Thanks for the update and fixes Klingo!
Last edited by Baertram : 01/24/21 at 12:40 PM.
Report comment to moderator  
Reply With Quote
Unread 09/14/20, 09:59 AM  
Echomap
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 52
Uploads: 3
Oh fun! Yes, this would be nice to be able to use in settings, via LibAddonMenu!
Report comment to moderator  
Reply With Quote
Unread 08/18/19, 09:30 AM  
Klingo
AddOn Author - Click to view AddOns

Forum posts: 16
File comments: 200
Uploads: 3
Originally Posted by Baertram
Are you sure the function in your example exists:
SetLeftListEntries
Shouldn't this be AddEntriesToLeftList ?
Whoops, this is an error in the documentation; I missed to update the renamed function. I'll fix that, thanks!

Originally Posted by Baertram
During my tests I got a duplicate table key error.
Does this mean teh left list and the right list cannot have the same indices/keys?
Correct - because you can move entries between the two listBoxes it must be possible to have all of them on one side and still be able to uniquely identify each entry (by enforcing unique keys)
Report comment to moderator  
Reply With Quote
Unread 08/18/19, 08:36 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 4912
File comments: 5989
Uploads: 78
Wow this looks great. Maybe think about adding them to LibAddonMenu-2.0 as well as controls?
Could come in handy, at least got 2 addons which could use them already
Thanks for the controls.

One idea:
I'd use the create function of your control to provide the anchor parameters, width and height and leftList and rightList parameters as well so one can do this all with 1 line.

I mean this:
Code:
local shifterBox = LibShifterBox("MyAddon", "MyShifterBox", parentControl, "Lefties", "Righties")
shifterBox:SetAnchor(TOPLEFT, headerControl, BOTTOMLEFT, 0, 20) -- required to correctly position/anchor it in your UI
shifterBox:SetDimensions(300, 200) -- optionally set your own overall dimensions of the shifterBox
shifterBox:SetLeftListEntries({[1] = "AAA", [2] = "BBB", [3] = "CCC"}) -- add three entries to the left list
shifterBox:AddEntryToRightList(4, "DDD") -- add one entry to the right list
To be able to be used like this (optional parameters after "Righties"):
Lua Code:
  1. local shifterBox = LibShifterBox("MyAddon", "MyShifterBox", parentControl, "Lefties", "Righties", TOPLEFT, headerControl, BOTTOMLEFT, 0, 20, 300, 200, leftListEntries, rightListEntries)

A lof of parameters but easier to setup the list controls in 1 row I think.

leftListEntries and rightListEntries could be a table, or maybe a function creating tables.
One can check this e.g. like this:

Lua Code:
  1. local rightListEntriesTable = {}
  2. if rightListEntriesParameter then
  3.  if type(rightListEntriesParameter) == "function" then
  4.    rightListEntriesTable = rightListEntriesParameter()
  5.  else
  6.    rightListEntriesTable = rightListEntriesParameter
  7.  end
  8. end

Will send you my idea via GitHub

Edit:
Are you sure the function in your example exists:
SetLeftListEntries
Shouldn't this be AddEntriesToLeftList ?

Edit2:
During my tests I got a duplicate table key error.
Does this mean teh left list and the right list cannot have the same indices/keys?
Last edited by Baertram : 08/18/19 at 09:25 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: