Go to Page... |
Compatibility: | Gold Road (10.0.0) Scions of Ithelia (9.3.0) |
Updated: | 04/29/24 03:37 PM |
Created: | 01/24/23 03:57 PM |
Monthly downloads: | 36,759 |
Total downloads: | 194,616 |
Favorites: | 104 |
MD5: |
--Adds a scrollable dropdown to the comboBoxControl, replacing the original dropdown, and enabling scrollable submenus (even with nested scrolable submenus) -- control parent Must be the parent control of the comboBox -- control comboBoxContainer Must be any ZO_ComboBox control (e.g. created from virtual template ZO_ComboBox) -- table options:optional = { -- number visibleRowsDropdown:optional Number or function returning number of shown entries at 1 page of the scrollable comboBox's opened dropdown -- number visibleRowsSubmenu:optional Number or function returning number of shown entries at 1 page of the scrollable comboBox's opened submenus -- boolean sortEntries:optional Boolean or function returning boolean if items in the main-/submenu should be sorted alphabetically: ZO_SORT_ORDER_UP or ZO_SORT_ORDER_DOWN -- table sortType:optional table or function returning table for the sort type, e.g. ZO_SORT_BY_NAME, ZO_SORT_BY_NAME_NUMERIC -- boolean sortOrder:optional Boolean or function returning boolean for the sort order -- string font:optional String or function returning a string: font to use for the dropdown entries -- number spacing:optional, Number or function returning a Number: Spacing between the entries -- boolean disableFadeGradient:optional Boolean or function returning a boolean: for the fading of the top/bottom scrolled rows -- table headerColor:optional table (ZO_ColorDef) or function returning a color table with r, g, b, a keys and their values: for header entries -- table normalColor:optional table (ZO_ColorDef) or function returning a color table with r, g, b, a keys and their values: for all normal (enabled) entries -- table disabledColor:optional table (ZO_ColorDef) or function returning a color table with r, g, b, a keys and their values: for all disabled entries -- function preshowDropdownFn:optional function function(ctrl) codeHere end: to run before the dropdown shows -- table XMLRowTemplates:optional Table or function returning a table with key = row type of lib.scrollListRowTypes and the value = subtable having -- "template" String = XMLVirtualTemplateName, -- rowHeight number = ZO_COMBO_BOX_ENTRY_TEMPLATE_HEIGHT, -- setupFunc = function(control, data, list) -- local comboBox = ZO_ComboBox_ObjectFromContainer(comboBoxContainer) -- comboBoxContainer = The ZO_ComboBox control you created via WINDOW_MANAGER:CreateControlFromVirtual("NameHere", yourTopLevelControlToAddAsAChild, "ZO_ComboBox") -- comboBox:SetupEntryLabel(control, data, list) -- end -- -->See local table "defaultXMLTemplates" in LibScrollableMenu -- -->Attention: If you do not specify all template attributes, the non-specified will be mixedIn from defaultXMLTemplates[entryType_ID] again! -- { -- [lib.scrollListRowTypes.ENTRY_ID] = { template = "XMLVirtualTemplateRow_ForEntryId", ... } -- [lib.scrollListRowTypes.SUBMENU_ENTRY_ID] = { template = "XMLVirtualTemplateRow_ForSubmenuEntryId", ... }, -- ... -- } -- table narrate:optional Table or function returning a table with key = narration event and value = function called for that narration event. -- Each functions signature/parameters is shown below! -- -> The function either builds your narrateString and narrates it in your addon. -- Or you must return a string as 1st return param (and optionally a boolean "stopCurrentNarration" as 2nd return param. If this is nil it will be set to false!) -- and let the library here narrate it for you via the UI narration -- Optional narration events can be: -- "OnComboBoxMouseEnter" function(m_dropdownObject, comboBoxControl) Build your narrateString and narrate it now, or return a string and let the library narrate it for you end -- "OnComboBoxMouseExit" function(m_dropdownObject, comboBoxControl) end -- "OnMenuShow" function(m_dropdownObject, dropdownControl, nil, nil) end -- "OnMenuHide" function(m_dropdownObject, dropdownControl) end -- "OnSubMenuShow" function(m_dropdownObject, parentControl, anchorPoint) end -- "OnSubMenuHide" function(m_dropdownObject, parentControl) end -- "OnEntryMouseEnter" function(m_dropdownObject, entryControl, data, hasSubmenu) end -- "OnEntryMouseExit" function(m_dropdownObject, entryControl, data, hasSubmenu) end -- "OnEntrySelected" function(m_dropdownObject, entryControl, data, hasSubmenu) end -- "OnCheckboxUpdated" function(m_dropdownObject, checkboxControl, data) end -- Example: narrate = { ["OnComboBoxMouseEnter"] = myAddonsNarrateComboBoxOnMouseEnter, ... } -- } function AddCustomScrollableComboBoxDropdownMenu(parent, comboBoxContainer, options)
Entry types: LSM_ENTRY_TYPE_NORMAL LSM_ENTRY_TYPE_DIVIDER LSM_ENTRY_TYPE_HEADER LSM_ENTRY_TYPE_CHECKBOX --Adds a new entry to the context menu entries with the shown text, where the callback function is called once the entry is clicked. --If entries is provided the entry will be a submenu having those entries. The callback can be used, if entries are passed in, too (to select a special entry and not an enry of the opening submenu). --But usually it should be nil if entries are specified, as each entry in entries got it's own callback then. --Existing context menu entries will be kept (until ClearCustomScrollableMenu will be called) -- --Example - Normal entry without submenu --AddCustomScrollableMenuEntry("Test entry 1", function() d("test entry 1 clicked") end, LibScrollableMenu.LSM_ENTRY_TYPE_NORMAL, nil, nil) --Example - Normal entry with submenu --AddCustomScrollableMenuEntry("Test entry 1", function() d("test entry 1 clicked") end, LibScrollableMenu.LSM_ENTRY_TYPE_NORMAL, { -- { -- label = "Test submenu entry 1", --optional String or function returning a string. If missing: Name will be shown and used for clicked callback value -- name = "TestValue1" --String or function returning a string if label is givenm name will be only used for the clicked callback value -- isHeader = false, -- optional boolean or function returning a boolean Is this entry a non clickable header control with a headline text? -- isDivider = false, -- optional boolean or function returning a boolean Is this entry a non clickable divider control without any text? -- isCheckbox = false, -- optional boolean or function returning a boolean Is this entry a clickable checkbox control with text? -- isNew = false, -- optional booelan or function returning a boolean Is this entry a new entry and thus shows the "New" icon? -- entries = { ... see above ... }, -- optional table containing nested submenu entries in this submenu -> This entry opens a new nested submenu then. Contents of entries use the same values as shown in this example here -- contextMenuCallback = function(ctrl) ... end, -- optional function for a right click action, e.g. show a scrollable context menu at the menu entry -- } --}, --[[additionalData]] { isNew = true, normalColor = ZO_ColorDef, highlightColor = ZO_ColorDef, disabledColor = ZO_ColorDef, font = "ZO_FontGame" } ) function AddCustomScrollableMenuEntry(text, callback, entryType, entries, additionalData) --Adds an entry having a submenu (or maybe nested submenues) in the entries table/entries function whch returns a table --> See examples for the table "entries" values above AddCustomScrollableMenuEntry --Existing context menu entries will be kept (until ClearCustomScrollableMenu will be called) function AddCustomScrollableSubMenuEntry(text, entries) --Adds a divider line to the context menu entries --Existing context menu entries will be kept (until ClearCustomScrollableMenu will be called) function AddCustomScrollableMenuDivider() --Pass in a table/function returning a table with predefined context menu entries and let them all be added in order of the table's number key --Existing context menu entries will be kept (until ClearCustomScrollableMenu will be called) function AddCustomScrollableMenuEntries(contextMenuEntries) --Populate a new scrollable context menu with the defined entries table/a functinon returning the entries. --Existing context menu entries will be reset, because ClearCustomScrollableMenu will be called! --You can add more entries later, prior to showing, via AddCustomScrollableMenuEntry / AddCustomScrollableMenuEntries functions too function AddCustomScrollableMenu(entries, options) --Set the options (visible rows max, etc.) for the scrollable context menu, or any passed in 2nd param comboBoxContainer -->See possible options above AddCustomScrollableComboBoxDropdownMenu function SetCustomScrollableMenuOptions(options, comboBoxContainer) --Show the custom scrollable context menu now at the control controlToAnchorTo, using optional options. --If controlToAnchorTo is nil it will be anchored to the current control's position below the mouse, like ZO_Menu does --Existing context menu entries will be kept (until ClearCustomScrollableMenu will be called) function ShowCustomScrollableMenu(controlToAnchorTo, options) --Hide the custom scrollable context menu and clear it's entries, clear internal variables, mouse clicks etc. function ClearCustomScrollableMenu()
Entry types: LSM_ENTRY_TYPE_NORMAL LSM_ENTRY_TYPE_DIVIDER LSM_ENTRY_TYPE_HEADER LSM_ENTRY_TYPE_CHECKBOX --Adds a new entry to the context menu entries with the shown text, which calls the callback function once clicked. --If entries is provided the entry will be a submenu having those entries. The callback can only be used if entries are passed in --but normally it should be nil in that case function AddCustomScrollableMenuEntry(text, callback, entryType, entries, isNew) --Adds an entry having a submenu (or maybe nested submenues) in the entries table function AddCustomScrollableSubMenuEntry(text, entries) --Adds a divider line to the context menu entries function AddCustomScrollableMenuDivider() --Pass in a table with predefined context menu entries and let them all be added in order of the table's number key function AddCustomScrollableMenuEntries(contextMenuEntries) --Set the options (visible rows max, etc.) for the scrollable context menu function SetCustomScrollableMenuOptions(options, scrollHelper) --Add a new scrollable context menu with the defined entries table. --You can add more entries later via AddCustomScrollableMenuEntry function too function AddCustomScrollableMenu(parent, entries, options) --Show the custom scrollable context menu now function ShowCustomScrollableMenu(controlToAnchorTo, point, relativePoint, offsetX, offsetY, options) --Hide the custom scrollable context menu and clear internal variables, mouse clicks etc. function ClearCustomScrollableMenu()
File Name |
Version |
Size |
Uploader |
Date |
2.1 |
41kB |
Baertram |
04/26/24 02:02 PM |
|
2.0 |
29kB |
Baertram |
03/21/24 05:38 AM |
|
1.9 |
28kB |
Baertram |
03/11/24 03:10 AM |
|
1.8 |
31kB |
Baertram |
02/26/24 03:42 AM |
|
1.7 |
27kB |
Baertram |
01/11/24 06:09 PM |
|
1.6 |
23kB |
Baertram |
12/10/23 11:26 AM |
|
1.5 |
23kB |
Baertram |
12/09/23 06:05 PM |
|
1.4 |
22kB |
Baertram |
11/13/23 02:59 PM |
|
1.3 |
22kB |
Baertram |
10/31/23 04:15 AM |
|
1.2 |
22kB |
Baertram |
10/30/23 03:56 AM |
|
1.1 |
7kB |
tomstock |
03/19/23 02:51 PM |
|
1.0 |
7kB |
01/24/23 03:57 PM |
Comment Options |
Gamer1986PAN |
View Public Profile |
Send a private message to Gamer1986PAN |
Find More Posts by Gamer1986PAN |
Add Gamer1986PAN to Your Buddy List |
Baertram |
View Public Profile |
Send a private message to Baertram |
Find More Posts by Baertram |
Add Baertram to Your Buddy List |
03/11/24, 04:45 AM | |
Forum posts: 0
File comments: 176
Uploads: 0
|
Thanks, Baertram & IsJustaGhost for the work on our favorite addons
|
|
ChrisK |
View Public Profile |
Send a private message to ChrisK |
Find More Posts by ChrisK |
Add ChrisK to Your Buddy List |
code65536 |
View Public Profile |
Send a private message to code65536 |
Find More Posts by code65536 |
Add code65536 to Your Buddy List |
Baertram |
View Public Profile |
Send a private message to Baertram |
Find More Posts by Baertram |
Add Baertram to Your Buddy List |
03/23/24, 10:00 AM | |
|
Yes, m_sortsItems is true by default. Which is correct as it matches that in ZO_ComboBox. However, the issue was with submenus not inheriting those m_* variables on initialize. This was more of a laps in thought on my part.
This inheritance should be rectified in the next update. However, it will only effect newly created submenus. If any of these internal values are changed after a submenu is created, it will not be effected by the change. I'm looking at some options of dealing with this. |
|
IsJustaGhost |
View Public Profile |
Send a private message to IsJustaGhost |
Find More Posts by IsJustaGhost |
Add IsJustaGhost to Your Buddy List |
03/31/24, 08:27 AM | |
|
Inventory implementation
Hey,
I'm trying to use this lib in XLGearBanker to address the issue of the sets list being too long to display in a standard submenu entry in an inventory slot menu. So far, I haven't been able to make it work. I tried to replace AddCustomSubMenuItem with AddCustomScrollableSubMenuEntry but it just does not display. I don't have much experience with custom UI elements, but I know I'm missing something. I pushed my update on this PR: https://github.com/B7TxSpeed/XLGearBanker/pull/1 Could you provide some examples or help if you have time, please? |
|
B7TxSpeed |
View Public Profile |
Send a private message to B7TxSpeed |
Find More Posts by B7TxSpeed |
Add B7TxSpeed to Your Buddy List |
03/31/24, 12:43 PM | ||
|
Re: Inventory implementation
And as all inventory context menus use ZO_Menu you cannot use LSm there, only LibCustomMenu (which is based on ZO_Menu). Either you need to rewrite ALL inventory context menus to use LSM instead, and that would make you rewrite all vanilla code (ending with insecure error messages every here and there most probably) or there is no way to use LSM "in combination" with inventory context menus. You can use LSM as scrollHelper on a ZOComboBox or as new context menu at any custom control or at least any control where another context menu via ZO_Menu wasn't added yet. Both cannot be used in combination, you can only replace your LCM implementation with LSM so you remove ZO_Menu context menus. I've updated the description and added that info, sorry for the confusion. LSM is based on ZO_ComboBox's dropdownObject which uses a ZO_SortFilterList (and thus is scrollable) where LibCustomMenu and vanilla code AddMenuItem use ZO_Menu which is no scrollable list. Both cannot be used in combination.
Last edited by Baertram : 03/31/24 at 12:49 PM.
|
|
|
Baertram |
View Public Profile |
Send a private message to Baertram |
Find More Posts by Baertram |
Add Baertram to Your Buddy List |
03/31/24, 04:11 PM | |||
|
Re: Re: Inventory implementation
I guess I'll have to find another way and not use the inventory context menus for that purpose. |
||
|
B7TxSpeed |
View Public Profile |
Send a private message to B7TxSpeed |
Find More Posts by B7TxSpeed |
Add B7TxSpeed to Your Buddy List |
04/01/24, 06:35 AM | ||||
|
Re: Re: Re: Inventory implementation
If your addon adds a custom control to the inventoryRow, like a marker icon or similar, you could use that cntrol to show a custom LSM scrollable context menu at it.
Or you could use the image of the item, and make a right click contex menu there: Just adding it to the default row's right click context menu won't work. But depending on your usecase, if you only want to add 2 enries like "Add to banked set" or "Reove frm banked set" it would be just enough to use LibScrollableMenu to add that entries to the normal inventory menu. You can even use a submenu there like "XL Gear Banker" -> "Add to set", "Remove from set", "...", "..."
Last edited by Baertram : 04/01/24 at 06:38 AM.
|
|||
|
Baertram |
View Public Profile |
Send a private message to Baertram |
Find More Posts by Baertram |
Add Baertram to Your Buddy List |