LO base open form full screen when launching database, how?

Hello,
I have followed this post to launch a specific form from my database. It works but the form shows all the editing menus.

Is it possible to open the form full screen, so the user can only use the buttons I created?

Thank you

Try this with a logical form’s event “When loading”

Function getParentObject(byval m, srvName$)
  do until m.supportsService(srvName)
    m = m.getParent()
  loop
  getParentObject = m
End Function

REM get the logical form's document, the document frame and dispatch .uno:FullScreen
Sub FormDocument_FullScreen(ev)
  doc = getParentObject(ev.Source, "com.sun.star.document.OfficeDocument")
  frame = doc.CurrentController.getFrame()
  dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
  dispatcher.executeDispatch(frame, ".uno:FullScreen", "", 0, Array())
End Sub
1 Like

OK thanks everyone. Seems Sokol92 has the answer to this curiosity. I set my db to the exact settings in Addresses_3.db and it works fine. Thanks again.

I use versions of the following macro on forms (ThankYouLibre!) :slight_smile:

Sub HideAllMenuToolbars ‘at custom size’
Dim xCurrentController as Object
Dim xLayoutManager as Object
’ If Design mode, just exit the routine and display standard menu and toolbars’
xCurrentController = thisComponent.CurrentController
If xCurrentController.isFormDesignMode Then
Exit Sub
End If
xLayoutManager = thisComponent.CurrentController.Frame.LayoutManager
xLayoutManager.visible = false 'toolbars!
'Resize (420,640) 'if you want
oFrame = StarDesktop.getCurrentFrame()
oWin = oFrame.getContainerWindow()
oWin.IsMaximized = true
End Sub

1 Like

Thank you,
I am using this macro:

SUB startup
  Dim ObjTypeWhat
  Dim ObjName As String
  ObjName = "switchboard"
  ObjTypeWhat = com.sun.star.sdb.application.DatabaseObject.FORM
  If ThisDatabaseDocument.FormDocuments.hasbyname(ObjName) Then 'Check the form exists'
     ThisDataBaseDocument.CurrentController.Connect() 'If the form exists connect to the database'
     ThisDatabaseDocument.CurrentController.loadComponent(ObjTypeWhat, ObjName, FALSE) 'Open the form'
  Else
      MsgBox "Error! Wrong form name used. " & ObjName
  End if
End Sub

shall I simply add yours to this?

yes fit relevant parts into a single sub > or try a new sub that calls both …

eg:

SUB compile_subs
call sub_1
call sub_2
END SUB

I got the error: “BASIC runtime error. Property or method not found: isFormDesignMode”, so I commented out

If xCurrentController.isFormDesignMode Then
Exit Sub
End If

Now the macro works but not full screen but as the sub startup I have written…

oFrame = StarDesktop.getCurrentFrame()
will get the frame in a standalone form, not in a form, which is part of a Base file. The frame in the Base file will be the part which you see when starting the Base file with tables, queries, forms and reports on the left.
Start the following code from the form document inside from Base:
oFrame = oEvent.Source.CurrentController.Frame

I am getting runtime error for the variable is not set…

Addresses.odb (14.3 KB)
See the attached file. Open the form. It will maximize.
The variable is set by the event, here Tools → Customize → Events → View Created.
There are also macros added for design of the windows, but I have only linked the form to the sub fullscreen.

Sorry to open this old thread but this code doesn’t work for me. My system info is:

Version: 7.5.5.2 / LibreOffice Community
Build: caf8fe7424262805f223b9a233
Environment: CPU Threads: 4;OS: Windows 10.0 Build 19405
User Interface: UI render: Skia/Raster; VCL:win
Locale: en.GB (en_GB); UI: en-GB
Misc Calc: threaded
Database HSQLDB Embedded

I downloaded the Adresses.odb and opened the form. It didn’t maximise. So I assigned the appropriate Macro (it wasn’t assigned to start with) but it still doesn’t maximise the form.

The code is as follows and I’ve assigned it to the Open Document Event. What have I done wrong?

Sub Fullscreen(oEvent AS OBJECT)
oFrame = oEvent.Source.CurrentController.Frame
oWin = oFrame.getContainerWindow()
oWin.IsMaximized = true
End Sub


This is how it is assigned in the example database.

Works here without any problem with the attached database and
Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: ca8fe7424262805f223b9a2334bc7181abbcbf5e
CPU threads: 6; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

Please ad a messagebox to the procedure to see if the event fires.

Sub Fullscreen(oEvent AS OBJECT)
oFrame = oEvent.Source.CurrentController.Frame
oWin = oFrame.getContainerWindow()
oWin.IsMaximized = true
msgbox "Maximized"
End Sub

OK, I made a mistake. Although no Macros were assigned when I downloaded Addresses.odb initially. I mistakenly assigned the Fullscreen Macro to the Open Document Event.

I’ve now assigned it, with your new line, to the View Created event. Yes I get the message saying that the event has fired but the form is not maximised. It’s slightly smaller than the screen and I need to click on the maximise icon to enlarge it to full screen. Here are some screenshots. The last one is after I manually maximised the form. The one previous to that is the supposed maximised view.

Oops. I missed out the supposedly maximised form. Here it is, just after seeing the message and closing it.

Something weird going on now. When I open the db I get the message and then when I open the form I get the message again. The form still doesn’t open maximised. Here is my modified version of the db. Does it behave that way to others?

Addresses_2.odb (14.4 KB)

You have linked the macro to the main window. First screenshot shows the main window, not the opened window for editing the form. Will have a look at your example.

Macro is working right here under Linux. Don’t know why it behaves different under Windows.
You could try to set the right position by

oWin.setPosSize(0,0,600,400,15)

600 pixel width, 400 pixel height → should be set to width an height you need.

1 Like

In your example, there are two listeners - for the .odb file and for the form.

  1. Open the .odb file, then Menu / Tools / Customize. Delete the macro.
  2. Open the form in edit mode and assign the macro to the Open Document event (instead of View Created).
1 Like

@sokol92 : Which system do you use? And: Did you try it with “view created”? Have tested both here: “view created” and “open document”. Both will work.

1 Like

OK, tried this code - in the form, not the .odb file:

Sub Fullscreen(oEvent AS OBJECT)
oFrame = oEvent.Source.CurrentController.Frame
oWin = oFrame.getContainerWindow()
’ oWin.IsMaximized = true
’ msgbox “Maximized”
oWin.setPosSize(0,0,1366,768,15)
End Sub

The figures of 1366 and 768 are the display resolution figures of my laptop, in Display Settings. It didn’t work.

Tried your suggestions sokol92 but still no joy.

Very strange.

Windows 10, LO 7.5.5.2.

Yes, I did. The effect is the same as described by the author of the topic.

1 Like