We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Forms; Hide Menu and Toolbar but display Navigation Bar

asked 2019-06-17 05:46:11 +0200

Coder99 gravatar image

updated 2021-06-12 00:21:23 +0200

Alex Kemp gravatar image

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.

edit retag flag offensive close merge delete



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 ✔ in upper left area of answer which satisfied the question.

Thank You.

Ratslinger gravatar imageRatslinger ( 2019-06-17 07:38:31 +0200 )edit

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

Please include a link when referring to another post.

Ratslinger gravatar imageRatslinger ( 2019-06-17 07:39:54 +0200 )edit

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

Coder99 gravatar imageCoder99 ( 2019-06-17 08:22:42 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-06-17 07:47:05 +0200

Ratslinger gravatar image

updated 2019-06-17 08:00:15 +0200

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

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

edit flag offensive delete link more


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

Ratslinger gravatar imageRatslinger ( 2019-06-17 07:53:01 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-06-17 05:46:11 +0200

Seen: 594 times

Last updated: Jun 17 '19