UrsaTeddy
December 29th, 2021, 09:53
Greetings,
I have been playing around with opening/closing windows based on their type and I have come across a behaviour that would lead me to think that windows are not really closed.
I have an extension that simply closes windows based on their type (or all of them). Based on a boolean parameter they are either reopened or not.
So I opened 6 windows.
50617
I then proceed to close all of those windows except for one. This is performed with the X on each window.
50618
I then run my extension that will close all windows that are allowed to be close (so no chat, no menus, no desktop items).
50619
I now reopen the story window and run the extension to close and then reopen all allowed windows.
50620
You will see in the image that all the other windows that were opened previously (except the Assets window) are reopened.
My code ...
function Refresh_Windows_By_Type(of_types, reopen_windows)
if reopen_windows == nil then reopen_windows = true end
local window_list = Interface.getWindows(true) <--- NOTE I AM ASKING ONLY FOR VISIBLE WINDOWS
for k,v in pairs(window_list)
do
local window_type = v.getClass()
if not TABLE.Is_In_Table(WM_EXCLUDE, window_type) <--- ensures the window is allowed to be closed
then
if TABLE.Is_Empty_Table(of_types) or TABLE.Is_In_Table(of_types, window_type)
then
local db_node = v.getDatabaseNode() or ""
local v_wx, v_wy = v.getPosition()
v.close()
if reopen_windows
then
window = Interface.openWindow(window_type, db_node)
window.setPosition(v_wx, v_wy)
end
end
end
end
end
So either the windows are not truly being closed and only hidden from view - hence the issue with getWindows(true) - or I am missing something here.
All help would be appreciated.
D
I have been playing around with opening/closing windows based on their type and I have come across a behaviour that would lead me to think that windows are not really closed.
I have an extension that simply closes windows based on their type (or all of them). Based on a boolean parameter they are either reopened or not.
So I opened 6 windows.
50617
I then proceed to close all of those windows except for one. This is performed with the X on each window.
50618
I then run my extension that will close all windows that are allowed to be close (so no chat, no menus, no desktop items).
50619
I now reopen the story window and run the extension to close and then reopen all allowed windows.
50620
You will see in the image that all the other windows that were opened previously (except the Assets window) are reopened.
My code ...
function Refresh_Windows_By_Type(of_types, reopen_windows)
if reopen_windows == nil then reopen_windows = true end
local window_list = Interface.getWindows(true) <--- NOTE I AM ASKING ONLY FOR VISIBLE WINDOWS
for k,v in pairs(window_list)
do
local window_type = v.getClass()
if not TABLE.Is_In_Table(WM_EXCLUDE, window_type) <--- ensures the window is allowed to be closed
then
if TABLE.Is_Empty_Table(of_types) or TABLE.Is_In_Table(of_types, window_type)
then
local db_node = v.getDatabaseNode() or ""
local v_wx, v_wy = v.getPosition()
v.close()
if reopen_windows
then
window = Interface.openWindow(window_type, db_node)
window.setPosition(v_wx, v_wy)
end
end
end
end
end
So either the windows are not truly being closed and only hidden from view - hence the issue with getWindows(true) - or I am missing something here.
All help would be appreciated.
D