Welcome, Guest
Please Login or Register.    Lost Password?

Toggle all windows but given
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Toggle all windows but given
#12632
Toggle all windows but given 4 Years, 3 Months ago  
Hi. I'm trying to make a script that toggles all windows but the I give as a first param.

Code:

function Statica_ToggleWindowsButGiven(strWindow)
  local visible = false
  listWindows = Rainlendar_GetWindows()
  for key, win in pairs(listWindows) do
    if strWindow~=win and Rainlendar_IsWindowVisible(win) then
      visible = true
      break
    end
  end
  --visible = false

--[[]]
  if visible then
    for key, win in pairs(listWindows) do
      if strWindow~=win then
        Rainlendar_HideWindow(win)
      end
    end
  else
    for key, win in pairs(listWindows) do
      if strWindow~=win then
        Rainlendar_ShowWindow(win)
      end
    end
  end
--[[
  if visible then
    Hotkey_Hide_Windows()
  else
    Hotkey_Show_Windows()
  end
  Rainlendar_ShowWindow("Clock and Management")
]]
end



I think the problem might be because Rainlendar_GetWindows() doesn't work as I would expect (don't return names of windows). Is there some reference for functions like that? Is there a function that would output something to the debug log?
Nux
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#12638
Re: Toggle all windows but given 4 Years, 3 Months ago  
The skin name is prefixed with the name of the window (i.e."skin::window") so you need to include it also in the parameter. You can find the reference documentation for all the functions from Rainlendar's help file. You can write log messages with Rainlendar_Log().
Rainy
Moderator
Posts: 6003
graph
User Online Now Click here to see the profile of this user
The administrator has disabled public write access.
 
#12645
Re: Toggle all windows but given 4 Years, 3 Months ago  
Cool. It works.

If anyone want to use the code - take it it's for free . Note that "Clock and Management" is my window which I want visible all the time (it has various toggle buttons for all other windows).

Code:

--
-- Toggle all windows but Statica management
--
function Hotkey_Toggle_Windows_But_Management_Clock()
  Statica_ToggleWindowsButGiven ("Statica", "Clock and Management")

  -- if closed - show it
  if not Rainlendar_IsWindowVisible("Clock and Management") then
    Rainlendar_ShowWindow("Clock and Management")
  end
end

--
-- Toggle all windows but given as the first param
--
function Statica_ToggleWindowsButGiven(strSkin, strWindow)
  local visible = false
  local strWindowPath = strSkin.."::"..strWindow
  listWindows = Rainlendar_GetWindows()
  for key, win in pairs(listWindows) do
    if strWindowPath~=win and Rainlendar_IsWindowVisible(win) then
      visible = true
      break
    end
  end
  --visible = false

  if visible then
    for key, win in pairs(listWindows) do
      if strWindowPath~=win then
        Rainlendar_HideWindow(win)
      end
    end
  else
    for key, win in pairs(listWindows) do
      if strWindowPath~=win then
        Rainlendar_ShowWindow(win)
      end
    end
  end
end

Nux
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#15215
Re: Toggle all windows but given 3 Years, 5 Months ago  
Hello coders

I am new to Rainlendar but would like to use the code you've given. Into where in Rainlendar do I put the code? And how to I activate it (i.e. call the function)? I want to assign it to a click on the Rainlendar icon on my iconbar.

Thanks for your time.
needinghelp
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#15236
Re: Toggle all windows but given 3 Years, 5 Months ago  
Scripts are in lua files which can be found in e.g. skins. Just be careful when you change something there because your Rainlendar might stop working.
Nux
Fresh Boarder
Posts: 7
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#15238
Re:Toggle all windows but given 3 Years, 5 Months ago  
OK; thanks. But I've given up on Rainlendar.
needinghelp
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
get the latest posts directly to your desktop