Why is it not possible to assign “go to next window” and “go to previous window” to key combinations? I can’t even record a macro to do that.
Why do you ask why something is not possible? Wouldn’t you like to know how it is possible?
Just like resizing/maximizing windows is handled by the operating system, so is switching windows.
On Mac OS X, you can switch between documents using Cmd + `, or Cmd + Shift + `.
On Windows and Linux, you can switch between all open windows (of all applications) with Alt + Tab and Alt + Shift + Tab.
Although it’s not possible to record a macro it is possible to write a macro to switch between documents.
Following macro can be assigned to a hotkey and switches to the next document of the same type. Example if you are editing a Calc spreadsheet it will only switch to other Calc spreadsheets. Same for Writer documents.
It might still need some work, but if you have problems post back with a comment and I’ll try and fix.
Option Explicit
Sub SwitchFrame
Dim oComponents As Object
Dim x As Object
Dim iCount As Integer
Dim i As Integer
Dim n As Integer
Dim sThis As String
Dim sDocs() As String
Dim sID As String
sThis = thisComponent.Title
sID = thisComponent.Identifier
oComponents = StarDesktop.Components.createEnumeration
iCount = 0
Do While oComponents.hasMoreElements()
x = oComponents.NextElement()
' Switch only to documents of the same type
If x.Identifier = sID Then
If InStr(x.DBG_properties, "Title") > 0 Then
iCount = iCount + 1
ReDim Preserve sDocs(1 to iCount) As String
sDocs(iCount) = x.Title
End If
End If
Loop
If iCount > 1 Then
For i = 1 To iCount
If sDocs(i) = sThis Then Exit For
Next i
i = i + 1
If i > iCount Then i = 1
oComponents = StarDesktop.Components.createEnumeration
Do While oComponents.hasMoreElements()
x = oComponents.NextElement()
If sDocs(i) = x.Title Then Exit Do
Loop
stardesktop.loadComponentFromURL(x.URL,"_default",0,array()) ' sets focus to the document
End If
End Sub
Seems to work great. Had problems hotkeying it, but I’m sure that has nothing to do with the macro. Shift-F7 finally worked. Thanks.
Seems to work great. Had problems hotkeying it, but I’m sure that has nothing to do with the macro. Shift-F7 finally worked. Thanks.
I also had some problems with hotkeys, I think it might be due to need to pick a libreoffice hotkey that doesn’t get overridden by Calc or Writer hotkey. At one point LibreOffice started crashing every time I tried to Expand user macros during hotkey assignment and I had to reset the profile and copy the macros across from the backup.
I had to change the last line as follows for it to work for me…
stardesktop.loadComponentFromURL(x.getURL(),"_default",0,Array()) ’ sets focus to the document
It’s not true that it’s handled ‘by the operating system’ because LibreWriter has the ‘window’ menu which contains the other documents to switch windows to.
For example Notepad++ has ‘Ctrl-Tab’ which simply goes to the next ‘window’ or ‘document’. and if you edit, it simply toggles between two, so you can easily transfer information between two open documents.
LibreOffice needs this capability. (simply a hotkey to manipulate the ‘window’ menu items, and navigate them)
The hotkey should default to Ctrl-Tab, or a variant, or it could be Ctrl-w for window control.
LibreWriter handles different documents as different instances, it seems? But it still has the ‘window’ menu which switches to the different documents.
I have tried most everything. Pressing Alt Tab gives you a window that displays all windows open in Windows. Pressing Tab again moves the selection to whichever window you want to be visible. I am a writer, and I use master documents. I have to switch back and forth between documents often. I try to avoid using the mouse. This works well for me.
Richard
I’m using Windows 7, and with Windows logo key and Tab I am able to switch between documents, both Writer and Calc.
LO Version: 5.1.4.2
Build ID: f99d75f39f1c57ebdd7ffc5f42867c12031db97a
It appears that LO 5.1.4 opens each document in a seperate program window so, you don’t need an option to switch between documents, since you can switch between program windows.
I haven’t been able to find a hotkey combo that works in LO 6.0.3.2 - Ubuntu 18.04. This is quite frustrating as in Ubuntu 16.04 I could easily toggle between open documents by either pressing Alt+Tab (which now switches between applications rather than docs) or by placing the cursor on the LO dock icon and sliding my finger on the touchpad (which used to switch between open docs). To toggle between docs I now have to click on the LO dock icon and click again on one of the open docs, which is not ideal as I suffer from RSI and am having to use my right hand too much. Is there any way I can toggle between docs without having to use my right hand to click?