- Menu : Wrap scroll into Titan_Menu
urnati [03-19-26 - 13:24]
- Menu : Wrap scroll into Titan_Menu
diff --git a/Titan/Titan.lua b/Titan/Titan.lua
index e58ce4c..de1a340 100644
--- a/Titan/Titan.lua
+++ b/Titan/Titan.lua
@@ -2124,7 +2124,7 @@ local function GeneratorFunction(owner, rootDescription)
local cat = TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY[index]
local cat_locale = L["TITAN_PANEL_MENU_CATEGORIES"][index]
local opts_plugins = Titan_Menu.AddButton(root, cat_locale)
- opts_plugins:SetScrollMode(scroll_hgt) -- in case menu height is larger than screen / window
+ Titan_Menu.SetScroll(opts_plugins, scroll_hgt) -- in case menu height is larger than screen / window
AddPlugin(opts_plugins, bar, cat) -- if same category
end
end
diff --git a/Titan/TitanMenu.lua b/Titan/TitanMenu.lua
index 250f996..8c22ddc 100644
--- a/Titan/TitanMenu.lua
+++ b/Titan/TitanMenu.lua
@@ -1263,6 +1263,13 @@ function Titan_Menu.SetAtribEnabled(owner, enabled)
owner:SetEnabled(enabled) -- .isEnabled
end
+---API Add scroll if menu is over given height in pixels
+---@param owner table Menu widget object
+---@param height number Pixels
+function Titan_Menu.SetScroll(owner, height)
+ owner:SetScrollMode(height) -- .isEnabled opts_plugins:SetScrollMode(scroll_hgt)
+end
+
---API Add a simple button to owner; expect this to be a parent
---@param owner table Menu widget object
---@param label string Label of the selector