johnsamir
Advanced OT User
Hi
as title says
im looking for this, in which files should i look for in order to review this? by the moment if i try to open content in a panel that is already full other content in the panel gets closed.
have tried this i get no errors but it does not work either also i don't get open/ open in next window widget
thanks
edit2
manage to get the widget menu visible again but backpack or content is not opening in the next available panel
as title says
im looking for this, in which files should i look for in order to review this? by the moment if i try to open content in a panel that is already full other content in the panel gets closed.
Lua:
if useThing then
if useThing:isContainer() then
-- if useThing:getParentContainer() then
menu:addOption(tr('Open'), function() g_game.open(useThing, useThing:getParentContainer()) end, shortcut)
menu:addOption(tr('Open in new window'), function() g_game.open(useThing) end)
else
-- Check if the bottom margin of the panel is full
local bottomPanelHeight = gameBottomPanel:getHeight()
local panelHeight = 80 -- Height of each panel
local numPanels = 0 -- Number of panels
-- Count the number of panels
for _, child in ipairs(gameRootPanel:getChildren()) do
if child:getId() == 'gameLeftPanels' or child:getId() == 'gameRightPanels' then
numPanels = numPanels + 1
end
end
-- Calculate the total height of panels
local totalPanelHeight = panelHeight * numPanels
-- If bottom margin of the panel is full, open container in the next available panel
if totalPanelHeight >= bottomPanelHeight then
-- Find the next available panel
local nextPanel
for _, child in ipairs(gameRootPanel:getChildren()) do
if child:getId() == 'gameLeftPanels' or child:getId() == 'gameRightPanels' then
nextPanel = child
break
end
end
if nextPanel then
menu:addOption(tr('Open'), function() g_game.open(useThing, nextPanel) end, shortcut)
menu:addOption(tr('Open in new window'), function() g_game.open(useThing) end)
else
-- Handle if no next panel is available
menu:addOption(tr('Open'), function() g_game.open(useThing) end, shortcut)
end
else
menu:addOption(tr('Open'), function() g_game.open(useThing) end, shortcut)
end
-- end
-- end
end
thanks
edit2
Code:
--if not classic and not g_app.isMobile() then shortcut = '(Ctrl)' else shortcut = nil end
local shortcut = nil
if not classic and not g_app.isMobile() then
shortcut = '(Ctrl)'
end
if useThing then
if useThing:isContainer() then
if useThing:getParentContainer() then
-- Container has a parent container, open in that container
menu:addOption(tr('Open'), function() g_game.open(useThing, useThing:getParentContainer()) end, shortcut)
menu:addOption(tr('Open in new window'), function() g_game.open(useThing) end)
else
-- Check if the bottom margin of the panel is full
local bottomPanelHeight = gameBottomPanel:getHeight()
local panelHeight = 80 -- Height of each panel
local totalPanelHeight = panelHeight * (gameLeftPanels:getChildCount() + gameRightPanels:getChildCount())
if totalPanelHeight >= bottomPanelHeight then
-- Bottom panel is full, find the next available panel on right or left side
local nextPanel
-- Check if there's space on the right side first
for _, child in ipairs(gameRootPanel:getChildren()) do
if child:getId() == 'gameRightPanels' then
nextPanel = child
break
end
end
-- If there's no space on the right, check the left side
if not nextPanel then
for _, child in ipairs(gameRootPanel:getChildren()) do
if child:getId() == 'gameLeftPanels' then
nextPanel = child
break
end
end
end
if nextPanel then
-- Open in the next available panel
menu:addOption(tr('Open'), function() g_game.open(useThing, nextPanel) end, shortcut)
menu:addOption(tr('Open in new window'), function() g_game.open(useThing) end)
else
-- No available panel found, open in the bottom panel
menu:addOption(tr('Open'), function() g_game.open(useThing) end, shortcut)
end
else
-- Bottom panel is not full, open in the bottom panel
menu:addOption(tr('Open'), function() g_game.open(useThing) end, shortcut)
-- end
--end
end
end
else
if useThing:isMultiUse() then
Last edited: