Open Spreadsheet Mimimised - BASIC

Newbie query: Windows10, LO 7.0.3.1

I am using loadComponentFromUrl(Url, "__blank", 0, arg()) in Calc to open a spreadsheet. I would like to open this spreadsheet ‘minimised’ to the taskbar. I have looked though Andrew P’s files and the Basic guide and cannot see how to do this.

If I open the file with arg()=“hidden”/True that achieves the required ‘invisibilty’, but it then seems to give me problems in closing the file (doc.close(True) and I finish up with a ‘file open’ warning on next run, but with no visible lockfile in the directory (nor in the taskbar) and I am having to reboot the PC to clear the lockfile.

Is there an ‘open minimised’ function to avoid this problem?

Hello,

On Ubuntu 20 with LO v7.0.4.2, tested as “hidden” and had no problems. Are you using a Global variable for the loaded doc?

Public: I take it you have no problems closing the hidden file in Ubuntu? Perhaps it is a Win thing. I am guessing LO does not have a ‘minimised’ function?

Cancel all that! Ran it this morning and arg ‘Hidden’ is working fine! It must have been a Windows glitch so apologies from Bill Gates.

It would be ideal, however, while debugging, to be able to minimise the open file to the tray rather than ‘hiding’ it, so I can view programmatic changes. Any options in LO? It does not like Arg ‘Visible/False’.

Hello,

Do not see an argument for minimized. However you can do this a bit differently. Change your load statement to not use any arguments. Then in the spreadsheet document attach the following macro to the Open Document event:

Sub runMinimised
    Dim oFrame As Object
    Dim oContainerWindow As Object
    oFrame = ThisComponent.getCurrentController().getFrame()
    oContainerWindow = oFrame.ContainerWindow
Rem    oContainerWindow.setVisible(True)
    oContainerWindow.IsMinimized = True
End Sub

Have also provided option for Hidden (Visible).

Sub Maximized
ThisComponent.getCurrentController().getFrame().ContainerWindow.IsMaximized = True
End Sub

Sub Minimized
ThisComponent.getCurrentController().getFrame().ContainerWindow.IsMinimized = True
End Sub

false returns to the previous size.

@Ratslinger - fantastic - just the job! Thank you for your help.That works perfectly.

May I ask for my education please from which OO/LO ‘help’ document you derived this code?

Do I need now to mark this ‘solved’ or similar?

@nigelb,

Thank you. Glad it is what you need. Answering your first question is not easy. Actually don’t remember source of code. Most recently used in this answer → How to address a control in a report. Probably originated from multiple sources. See this post → To learn LibreOffice Base are there introductions or tutorials?.

One document you have → OOME (Pitonyak) and others may be of interest. Also look there at Useful Extentions. MRI (my choice) & XRAY allow examination of many things. For Mri use this link for access → hanya /MRI

For last question, if this answers your question please tick the :heavy_check_mark: (upper left area of answer). It helps others to know there was an accepted answer.