Hey guys,
I've been working on a script that will hide/show dockers individually.
My approach is:
- get the screen dimensions of Reaper's main window
- search for all docker windows (= REAPER_dock) and also get their screen dimensions
- now to get the right docker, I compare the right value with the width value of the screen
And that's where I'm stuck, now.
The logical step to show/hide the docker was to use reaper.JS_Window_Show().
However, when using this method, the windows inside the docker get hidden, but not the docker itself, as shown here:
https://imgur.com/ppLEWBj
The goal is NOT to terminate running scripts, therefore reaper.JS_Window_Destroy() is no option.
View: Show docker 40279, perfectly shows, that it's possible to hide dockers without terminating the running scripts.
I checked the child windows when using this action (all dockers hidden).
reaper.JS_Window_IsVisible() gave me a false for all the child windows.
The same thing, that I achieved by using JS_Window_Show().
But apparently there is another mechanism involed, that will update the arrange or the docker windows. Otherwise it would look like my screenshot from above.
Maybe someone can help?
Here's my code:
Code:
dofile(reaper.GetResourcePath().."/UserPlugins/ultraschall_api.lua")
hwnd = reaper.GetMainHwnd() -- get Reaper main
retval, width, height = reaper.JS_Window_GetClientSize(hwnd) -- get window dimensions
retval, docker_list = reaper.JS_Window_ListFind("REAPER_dock", false) -- find all windows called REAPER_dock
docker_count, docker_array = ultraschall.CSV2IndividualLinesAsArray(docker_list) -- create docker array from list
for i=1, docker_count do
docker_hwnd = reaper.JS_Window_HandleFromAddress(docker_array[i]) -- convert address to hwnd
retval, left, top, right, bottom = reaper.JS_Window_GetRect(docker_hwnd) -- get docker dimensions
if right == width then -- get right docker
if reaper.JS_Window_IsVisible(docker_hwnd) then
reaper.JS_Window_Show(docker_hwnd, "HIDE") -- hide all children of right docker
else
reaper.JS_Window_Show(docker_hwnd, "SHOW") -- hide all children of right docker
end
end
end