Forms; Hide Menu and Toolbar but display Navigation Bar

Hi there,
I would like to hide the Menu and Toolbar, but display the Navigation bar on LO Forms…

I have tried the following macro at Form/Load time but this also hides the Navigation Bar at the bottom of the form (ie First/Next rec, prev/Last, Save, New rec, refresh etc…)

Sub HideAllMenuToolbars
   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
End Sub

How do I display just the Navigation bar ?
Any suggestions/info appreciated, many thanks.

@Coder99,

First a couple of notes. Have noticed you changing question titles and adding [Solved] (or similar) to them. This is not proper procedure. Instead please the Xclose selection in lower right corner of your question. This will mark the title correctly.

Also, please help others to know the question has been answered by clicking on the :heavy_check_mark: in upper left area of answer which satisfied the question.

Thank You.

Edited question for readability - use formatted text icon on toolbar for this.

Please include a link when referring to another post.

My apologies for this and will certainly follow the protocol in future…

Have modified the macro. Posted macro is to hide ALL as the title of the Sub hints.

For this to work, your toolbar needs to be set visible already as are the others. The routine then cycles through each iten and closed those that are not the Navigation Bar:

Option Explicit
Sub HideAllMenuToolbars
   Dim oCurrentController as Object
   Dim oLayoutManager as Object
   Dim oElements as Object
   Dim oXUIElement As Object
   Dim iStart As Integer
   Dim iEnd As Integer
   Dim x As Integer
   Dim sResourceURL As String
Rem If Design mode, just exit the routine and display standard menu and toolbars
   oCurrentController = thisComponent.CurrentController
   If oCurrentController.isFormDesignMode Then
       Exit Sub
   End If
   oLayoutManager = thisComponent.CurrentController.Frame.LayoutManager
Rem   xLayoutManager.visible = false
   oElements = oLayoutManager.getElements()
   iStart = LBound(oElements)
   iEnd = UBound(oElements)
   For x = iStart to iEnd
       oXUIElement = oElements(x)
       sResourceURL = oXUIElement.ResourceURL
       If sResourceURL <> "private:resource/toolbar/formsnavigationbar" Then
           oLayoutManager.hideElement(sResourceURL)
       EndIf
   next
End Sub

You can attach this to the event or button of your choice.

Note, if toolbar not visible you may need to resize the form (just any resize). There are outstanding bugs on this for some time.